How to change button text in file upload control? - c#

I try to change text of file upload control browse button. I made file upload control visible=false and I added another textbox and button:
.aspx file:
<asp:FileUpload ID="fuUploadPhoto" runat="server" visible="false"/>
<asp:TextBox ID="tbFilePath" runat="server" />
<asp:Button ID="btnChooseFile" runat="server" Text="Choose file from disk" />
next I try to add Attribute to btnChooseFile in PageLoad in .cs. Unfortunately it doesn't work and I don't know why. Where I made a mistake?
.cs file:
protected void Page_Load(object sender, EventArgs e)
{
btnChooseFile.Attributes.Add("onclick", "document.getElementById(" + fuUploadPhoto.ClientID + ").click()");
MultiViewAddPhoto.SetActiveView(viewAddPhotoStepOne);
}
protected void btnChooseFile_Click(object sender, EventArgs e)
{
if (fuUploadPhoto.HasFile)
{
tbFilePath.Text = fuUploadPhoto.PostedFile.FileName;
string filename = Path.GetFileName(fuUploadPhoto.FileName);
string ext = Path.GetExtension(filename);
imageGuid = Guid.NewGuid();
string contenttype = String.Empty;
switch (ext)
{
case ".jpg":
contenttype = "image/jpg";
break;
case ".jpeg":
contenttype = "image/jpg";
break;
case ".png":
contenttype = "image/png";
break;
}
if (string.IsNullOrEmpty(contenttype))
{
ltrErrorMessage.Text = "Nieprawidłowy format pliku!";
}
//prawidłowy format pliku
else
{
if (fuUploadPhoto.PostedFile.ContentLength > MyConsts.DAL.SizeOfPhoto)
{
ltrErrorMessage.Text = "Plik może mieć maksymalnie "+ MyConsts.DAL.SizeOfPhoto/1024 + " Mb! Zmniejsz plik i spróbuj ponownie.";
}
//jeśli prawidłowy format i rozmiar zdjęcia
else
{
try
{
filePath = ConfigurationManager.AppSettings["FilesPath"] + "\\" + Request.QueryString["konkurs"] + "\\" + imageGuid + ext;
path = "\\" + Request.QueryString["konkurs"] + "\\" + imageGuid + ext;
//zapisujemy plik na dysk
fuUploadPhoto.SaveAs(filePath);
if (File.Exists(filePath))
{
imgInspirationPhoto.ImageUrl = filePath;
imgInspirationPhoto.Visible = true;
}
else
{
imgInspirationPhoto.Visible = false;
}
}
catch (Exception ex)
{
Logger.Error(ex.Message, LogSource, ex);
}
}
}
}
}

When you make the fileupload visible false it won't be rendered on the page i.e its not hidden but not present. hence make it display none rather than visible false.
Try this
protected void Page_Load(object sender, EventArgs e)
{
btnChooseFile.Attributes.Add("onclick", "jQuery('#" + fuUploadPhoto.ClientID + "').click();return false;");
//MultiViewAddPhoto.SetActiveView(viewAddPhotoStepOne);
}
in aspx file:
<div style="display:none;">
<asp:FileUpload ID="fuUploadPhoto" runat="server"/>
</div>
remember to add reference to jQuery library in the aspx page;
Update: Also the file is not available in the code behind until full postback This solution might help

using two js files http://the-echoplex.net/demos/upload-file/file-upload.js and http://the-echoplex.net/demos/upload-file/jelly/min.js .And add the file-upload.css file.Your sample
aspx file is,
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script src="script/jelly.js" type="text/javascript"></script>
<style type="text/css">
/****************** Start page styles ********************************************/
body {
background: #DFA01B;
font-family: arial, sans-serif;
font-size: 11px;
}
#wrap {
max-width: 600px;
margin: 30px auto;
background: #fff;
border: 4px solid #FFD16F;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px;
padding: 20px;
}
.field {
padding: 0 0 1em;
}
</style>
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div id="wrap">
<form enctype="multipart/form-data" action="#" method="post">
<div class="field">
<label class="file-upload">
<span><strong>Put YOUR TEXT</strong></span>
<%--<input type="file" name="uploadfile" onclintclick="test_load()" />--%>
<asp:FileUpload
ID="FileUpload1" name="uploadfile" runat="server"
ondatabinding="FileUpload1_DataBinding" />
</label>
</div>
</form>
</div><!--/ wrap -->
<script src="script/file-upload.js" type="text/javascript"></script>
</form>
</body>
</html>
and CSS file,
body {
}
/*
As this stylesheet is lazy loaded these styles only apply if JavaScript is enabled
*/
.file-upload {
overflow: hidden;
display: inline-block;
position: relative;
vertical-align: middle;
text-align: center;
/* Cosmetics */
color: #fff;
border: 2px solid #2FA2FF;
background: #6FBEFF;
/* Nice if your browser can do it */
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
text-shadow: #000 1px 1px 4px;
}
.file-upload:hover {
background: #2FA2FF;
}
.file-upload.focus {
outline: 2px solid yellow;
}
.file-upload input {
position: absolute;
top: 0;
left: 0;
margin: 0;
font-size: 70px;
/* Loses tab index in webkit if width is set to 0 */
opacity: 0;
filter: alpha(opacity=0);
}
.file-upload strong {
font: normal 1.75em arial,sans-serif;
}
.file-upload span {
position: absolute;
top: 0;
left: 0;
display: inline-block;
/* Adjust button text vertical alignment */
padding-top: .45em;
}
/* Adjust the button size */
.file-upload { height: 3em; }
.file-upload,
.file-upload span { width: 14em; }
.file-upload-status {
margin-left: 10px;
vertical-align: middle;
padding: 7px 11px;
font-weight: bold;
font-size: 16px;
color: #888;
background: #f8f8f8;
border: 3px solid #ddd;
}
you can download sample project at changedfileuploadbutton text

You can't using the standard asp file upload control.
You could create your own custom control which inherits from FileUpload, there you could add custom behaviour:
public class MyFileUpload : FileUpload
{
//do stuff
}

Related

stop alert box from firing on every postback

I have a webform that displays an alert box when a searched for item is not found. the alertbox is all asp side, calling it is c# side in codebehind.
the issue is that after the first time it is called, it calls on every postback of the page. after the click it should not fire again until after another missed search.
i have tried if(!ispostback), but the initial firing is a postback, so it won't fire at all.
during the postback it doesn't even call the c# code again, it just shows the alertbox.
<style type="text/css">
.alertBox
{
position: absolute;
top: 100px;
left: 50%;
width: 500px;
margin-left: -250px;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
padding: 4px 8px;
}
</style>
<script type="text/javascript">
function closeAlert(e) {
e.preventDefault();
this.parentNode.style.display = "none";
}
</script>
</head>
<body>
<form id="form_rooftopSAQPM" runat="server">
<div runat="server" id="AlertBox" class="alertBox" Visible="false">
<div runat="server" id="AlertBoxMessage"></div>
<button onclick="closeAlert.call(this, event)">Ok</button>
</div>
...
private void site_Load(string siteNumber)
{
DataSet ds = retrieveDataFromSQL("exec s_RooftopSite " + siteNumber, "Couldn't retrieve site information");
if(ds.Tables.Count>0)
{
//load the fields
txtFoo.Text = ds.Tables[0].Rows[0][0].ToString();
}
else
{
MessageBoxShow("Site not found.");
}
}
protected void MessageBoxShow(string message)
{
this.AlertBoxMessage.InnerText = message;
this.AlertBox.Visible = true;
}
...
how can i set the alertbox to only fire when it is called by the c# code, yet still allow it to pop off on the first call, which is a postback?
I fixed it by switching from JavaScript to C#:
ASP:
<asp:Button runat="server" id="btnCloseAlert"
onclick="btnCloseAlert_Click" Text="Ok" />
CodeBehind in C#:
protected void btnCloseAlert_Click(object sender, EventArgs e)
{
AlertBox.Visible = false;
AlertBoxMessage.InnerText = "";
}

Missing characters in WebBrowser printout

I have a WPF application that uses the WebBrowser control in order to print html documents.
My problem is that from time to time some of the characters are missing from the generated documents.
I tried to replace the printer and cables and I also validated the html markup here.
This is how I generate the printing:
public static class HtmlPrint
{
public static void Print(string html, string documentTitle)
{
var wb = new System.Windows.Forms.WebBrowser { DocumentText = html };
wb.DocumentCompleted += wb_DocumentCompleted;
}
private static void wb_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e)
{
var wb = ((System.Windows.Forms.WebBrowser)sender);
wb.Print();
wb.Dispose();
}
}
HTML sample:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Items report</title>
<style type='text/css'>
html, body {
margin: 0;
padding: 0;
border: 0;
width: 100%;
}
table.gridtable {
font-family: verdana,arial,sans-serif;
font-size: 11px;
color: #333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
margin-top: 10px;
}
table.gridtable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #dedede;
}
table.gridtable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
/*white-space:nowrap*/
}
</style>
</head>
<body dir="rtl">
<h3>15/12/2015 09:22:17</h3>
<h3>Items for station: 1</h3>
<br />
<table class="gridtable">
<tr>
<th>Location</th>
<th>Item</th>
<th>Description</th>
<th>Color</th>
<th>Size</th>
<th>Qty</th>
<th>Remarks</th>
</tr>
<tr>
<td>AD393</td>
<td>06957TO_GRE_S</td>
<td>Green shirt</td>
<td>GREEN-GRAY</td>
<td>S(36)</td>
<td>0</td>
<td>AD-37-5<br />AD-38-3<br />AD-38-5<br />AD-39-0<br />AD-39-3<br />AD-39-5<br />BC-38-1</td>
</tr>
<tr>
<td>CA183</td>
<td>A100000000464</td>
<td>White golf shirt</td>
<td>WHITE</td>
<td>XS/S (34-36)</td>
<td>0</td>
<td>AI-25-1<br />AK-25-1<br />AK-36-6<br />AK-37-6<br />AL-24-1<br />AL-25-1<br />CA-18-3</td>
</tr>
</table>
Any ideas on how to fix it?
UPDATE
I've tried using the System.Windows.Controls.WebBrowser as follows but it prints empty pages:
public static void Print(string html)
{
/*
html is the actual HTML data e.g.
<!DOCTYPE html>
<html lang="he-IL" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=9">
...
*/
try
{
var wb = new System.Windows.Controls.WebBrowser();
wb.LoadCompleted += Wb_LoadCompleted; //never called
wb.Loaded += Wb_Loaded; //never called
wb.NavigateToString(html);
mshtml.IHTMLDocument2 doc = wb.Document as mshtml.IHTMLDocument2;
doc.execCommand("Print", true, false);
}
catch (Exception ex)
{
//no exception raised
throw;
}
}

Disable a page dynamically

I've an aspx page and I want to disable that page dynamically on a IF condition.
Here, By the word 'Disable' I mean an exactly same condition when a pop-up or a Radwindow opens and the Parent page gets disabled and the user is not able to do anything to the parent page until the pop-up gets closed.
For Ajax or Rad Controls, I can set the 'Modal' attribute of the control to true to make Parent page disabled. But what to do for my required condition.
Any suggestion would be appreciated.
You achieve the disabled effect by adding a div that covers the page using Javascript or JQuery.
var documentHeight = $(document).height();
$("body").append("<div style='z-index: 100; background: lightgray; opacity: 0.5; width: 100%; height: " + documentHeight + "px; position: absolute; left: 0; top: 0;'></div>");
The caveat is that this isn't "secure", if that's what you're after (the user could "hack" the disabling pane using Firebug or similar).
You can use ModalPopupExtender, take a look at my sample. I use this concept in all my sites and works great for all types of browsers.
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="ConfirmDialogUserControl.ascx.cs"
Inherits="GP.Solutions.UserControls.ConfirmDialogUserControl" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<script type="text/javascript">
var _source;
var _popup;
function ShowConfirmDialog(source, message) {
this._source = source;
this._popup = $find('mdlPopup');
var displayDiv = document.getElementById('<%= ConfirmMessageDiv.ClientID %>');
displayDiv.innerText = message;
displayDiv.textContent = message;
this._popup.show();
}
function ConfirmDialogOk() {
this._popup.hide();
__doPostBack(this._source.name, '');
}
function ConfirmDialogCancel() {
this._popup.hide();
this._source = null;
this._popup = null;
}
</script>
<asp:Panel ID="pnlModal" runat="server" CssClass="modalPopup" style="display:none;">
<div class="modalHeader">
<div id="DivImage" runat="server"> </div>
<asp:Label ID="TitleLabel" runat="server" Text="" CssClass="modalTitle"></asp:Label>
</div>
<asp:Panel ID="pnlControls" runat="server" CssClass="modalContent">
<div id="ConfirmMessageDiv" runat="server"></div>
</asp:Panel>
<div class="modalControlsContainer">
<asp:Button ID="btnConfirmDialogOk" runat="server" CssClass="modalButton" Text="" />
<asp:Button ID="btnConfirmDialogCancel" runat="server" CssClass="modalButton" Text="" />
</div>
</asp:Panel>
<asp:ModalPopupExtender ID="ModalPopupExtender1" behaviorid="mdlPopup" runat="server" TargetControlID="pnlModal"
PopupControlID="pnlModal" OkControlID="btnConfirmDialogOk" OnOkScript="ConfirmDialogOk();" CancelControlID="btnConfirmDialogCancel"
OnCancelScript="ConfirmDialogCancel();" DynamicServicePath="" Enabled="True" BackgroundCssClass="modalBackground" DropShadow="true">
</asp:ModalPopupExtender>
Here is css code used in this case:
.modalBackground
{
background-color:Black;
filter:alpha(opacity=60);
opacity:0.6;
}
.modalPopup
{
background-color:White;
border: 1px solid green;
width:280px;
padding: 10px 10px 10px 10px;
}
.modalPopupFullWidth
{
background-color:White;
border: 1px solid green;
padding: 10px 10px 10px 10px;
}
.modalHeader
{
width:auto;
border: 1px solid silver;
height:25px;
background-color:#F2F2F2;
}
.modalTitle
{
color:Black;
font-size: 11px;
font-weight:bold;
position:relative;
left:30px;
top:-20px;
}
.modalImageInformation
{
background-image: url('information.png');
background-repeat: no-repeat;
width:26px;
height:26px;
border: 0;
}
.modalImageWarning
{
background-image: url('warning.png');
background-repeat: no-repeat;
width:26px;
height:26px;
border: 0;
}
.modalImageError
{
background-image: url('error.png');
background-repeat: no-repeat;
width:26px;
height:26px;
border: 0;
}
.modalImageQuestion
{
background-image: url('question.png');
background-repeat: no-repeat;
width:26px;
height:26px;
}
.modalImageSearch
{
background-image: url('search.png');
background-repeat: no-repeat;
width:26px;
height:26px;
}
.modalContent
{
padding-top:10px;
padding-bottom:0px;
}
.modalControlsContainer
{
margin-left:auto;
margin-right:auto;
text-align:center;
padding-top:5px;
}
.modalButton
{
background-image: url('button-113x28.png');
background-color:transparent;
width:113px;
height:28px;
border: 0px none transparent;
color: White;
font-size:11px;
cursor:pointer;
margin-top:10px;
margin-left:auto;
margin-right:auto;
text-align:center;
}
.hidden { display: none; }
.unhidden { display: block; }

Checking username availability

I have created an check username availability inside a createuserwizard. And i had added a progress indicator to the checking process and would show a spinner image (in gif format) and it was done by using java script.
if the system is in the midst of checking the username in database, it would display the spinner image and at the same time display a text "Checking availability..."
And the problem not is the spinner image do not appear when it was checking..
Here is code:
<script language="javascript" type="text/javascript">
// Hook the InitializeRequest event.
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(InitializeRequest);
function InitializeRequest(sender, args) {
// Change div's CSS class and text content.
$get('UserAvailability').className = 'progress';
$get('UserAvailability').innerHTML = 'Checking availability...';
}
</script>
<asp:UpdatePanel runat="server" ID="up1">
<ContentTemplate>
<tr>
<td class="style4">Username:</td>
<td>
<asp:TextBox runat="server" ID="UserName" AutoPostBack="True"
ontextchanged="Username_Changed" Width="190" />
<div runat="server" id="UserAvailability" style="background-position: left; background-repeat: no-repeat; margin-left: -250px; padding-left: 22px; float:right;"></div>
</td>
</tr>
</ContentTemplate>
</asp:UpdatePanel>
Here is the code behind:
protected void Username_Changed(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(2000);
TextBox UserNameTextBox = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName");
if (Membership.GetUser(UserName.Text) != null)
{
UserAvailability.InnerText = "Username taken, sorry.";
UserAvailability.Attributes.Add("class", "taken");
}
else
{
UserAvailability.InnerText = "Username available!";
UserAvailability.Attributes.Add("class", "available");
}
}
I have used a masterpage, I had tried putting the JS file inside masterpage, but the image still not appearing.
EDIT
<style type="text/css">
#UserAvailability
{
padding-left: 22px;
margin-left: 30px;
float: left;
background-position: left;
background-repeat: no-repeat;
}
.progress
{
background-image: url(Images/spinner.gif);
}
.taken
{
background-image: url(Images/taken.gif);
}
.available
{
background-image: url(Images/available.gif);
}
</style>

Twitter API Atom Aggregator with C#

My issue is that I have inherited the launch of a site which has a Twitter feed ticker placed as an absolute footer on the page. The administration has decided they do not want any retweets or #mentions included in the feed. I can see the feed is being aggregated through Atom RSS. I have attempted to just change the search terms, and the twitter URL in the C# code, and the whole site crashes.
Unfortunately, I am completely unfamiliar in C#, so my ability to modify this code is limited, at best.
The web site is constructed with includes for the header, footer, twitter bar, etc.
Furthermore, the projected launch for the site is this evening at COB, so drafting another plug-in from scratch is not really an option.
The ticker is called to the page with this (The code is missing its opening and closing comment brackets so it would display here):
com.omniupdate.div label="ticker" path="/z-omniupdate/fakes/bfeo/2012/ticker.html"
bf2012:ticker runat="server"
/com.omniupdate.div
The CSS is:
#ticker{
width: 100%;
height: 43px;
border-top: 1px solid #939241;
background: #bdcc2a url('/bfeo/2012/img/tweet-bg.gif') 0 0 repeat-x;
background: -moz-linear-gradient(#bdcc2a, #a9b625);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#a9b625), to(#e4c595));
background: -webkit-linear-gradient(#bdcc2a, #a9b625);
background: -o-linear-gradient(#bdcc2a, #a9b625);
position:fixed;
z-index: 1000;
bottom: 0;
}
#ticker p{
font-size: 15px;
color: #fff;
text-transform: uppercase;
float: left;
line-height: 43px;
margin-right: 10px;
}
.ticker-engage {
list-style: none;
padding: 0;
margin: 8px 0 0 0;
width: 108px;
height: 28px;
float: left;
}
.ticker-engage li{
display: inline;
}
.ticker-engage li a{
height: 28px;
width: 28px;
text-indent: -9999px;
float: left;
margin: 0 2px 0 0;
}
.ticker-engage li a.twitter{
background: url('/bfeo/2012/img/twitter-sm.png') 0 0 no-repeat;
}
.ticker-engage li a.facebook{
background: url('/bfeo/2012/img/facebook-sm.png') 0 0 no-repeat;
}
.ticker-engage li a.youtube{
background: url('/bfeo/2012/img/youtube-sm.png') 0 0 no-repeat;
}
#tweetlist{
list-style: none;
padding: 7px 20px 0 20px;
height: 36px;
width: 666px;
float: left;
background: url('/bfeo/2012/img/tweet-bg.gif') 0 0 repeat-x;
background: -moz-linear-gradient(#aab726, #98a322);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#aab726), to(#98a322));
background: -webkit-linear-gradient(#aab726, #98a322);
background: -o-linear-gradient(#aab726, #98a322);
font-size: 12px;
}
#tweetlist li{
display: inline;
}
#tweetlist li a:link, #tweetlist li a:visited{
color: #fff;
text-decoration: none;
font-weight: normal;
}
#tweetlist li a:hover, #tweetlist li a:focus{
text-decoration: underline;
}
#tweetlist li span{
color: #ffe400;
}
Ticker.ascx:
<%# Control Language="C#" AutoEventWireup="true" CodeFile="ticker.ascx.cs" Inherits="bf_controls_ticker" %>
<div id="ticker">
<div class="wrapper clearfix">
<p>Engage with us</p>
<ul class="ticker-engage">
<li><a class="facebook" target="_blank" href="http://www.facebook.com/booththinking">
Facebook</a></li>
<li><a class="twitter" target="_blank" href="http://twitter.com/booththinking">Twitter</a></li>
<li><a class="youtube" target="_blank" href="http://www.youtube.com/user/BoothThinking">
Youtube</a></li>
</ul>
<form id="form1" runat="server">
<div>
<ul id="tweetlist">
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</ul>
</div>
</form>
</div>
</div>
ticker.ascx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml;
using System.Text;
public partial class bf_controls_ticker : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(HttpGet("http://search.twitter.com/search.atom?q=booththinking"));
XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);
ns.AddNamespace("at", "http://www.w3.org/2005/Atom");
ns.AddNamespace("twitter", "http://api.twitter.com/");
XmlNodeList entries = doc.DocumentElement.SelectNodes("//at:entry", ns);
//Response.Write(entries.Count);
StringBuilder sb = new StringBuilder();
foreach (XmlNode node in entries)
{
sb.Append(String.Format("<li><span>{2}:</span> {1}</li>", node.ChildNodes[2].Attributes["href"].Value, node.ChildNodes[3].InnerText, node.LastChild.FirstChild.InnerText.Split(' ')[0]));
}
Literal1.Text = sb.ToString();
}
private string HttpGet(string URI)
{
System.Net.WebRequest req = System.Net.WebRequest.Create(URI);
System.Net.WebResponse resp = req.GetResponse();
if (resp == null) return null;
System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
string responsexml = sr.ReadToEnd().Trim();
sr.Close();
return responsexml;
}
}
If I understand you correctly you could just check the string for the pattern you are trying to skip.
In your for each loop try something like this:
foreach (XmlNode node in entries)
{
var content = node.SelectSingleNode("at:content", ns).InnerText;
if(!content.ToLower().Contains("#somename"))
{
sb.Append(String.Format("<li><span>{2}:</span> {1}</li>", node.ChildNodes[2].Attributes["href"].Value, node.ChildNodes[3].InnerText, node.LastChild.FirstChild.InnerText.Split(' ')[0]));
}
}
have a look at regular expressions for more complicated pattern matching

Categories