want to add href value to anchor in aspx page from a code behind strin
Asked By praveen madhogaria
06-Sep-10 04:15 AM
Hi All,
I am using a anchor tag in my aspx page.now in this href value i want to add the url and display value from a string which is present at my code-behind.
test.aspx.cs
string sLink=http://test.com/layouts/scan.aspx;
test.aspx
<a id="A1" href='<%=sLink %>' runat="server"><%=sLink%></a>
re: want to add href value to anchor in aspx page from a code behind strin
harsh shah replied to praveen madhogaria
06-Sep-10 04:32 AM
Hi,
no need to bind a string value.
simply make a anchor tag in to server control and then u have get directly anchor control in a .cs file.
in a cs file give a url name in a href property.
i have given a below code.
test.aspx
<a id="A1" runat="server"></a>
test.aspx.cs
string sLink=http://test.com/layouts/scan.aspx;
A1.href=sLink;
A1.InnerText =sLink;
Let me know
Regards,
Harsh Shah
re: want to add href value to anchor in aspx page from a code behind strin
Anand Malli replied to praveen madhogaria
06-Sep-10 04:35 AM
Hi All,
you can access this anchor tag over there in your code behind and set its href over there only,i do not find any difficulty in this..its simple like below code,yeah the variable must have to public to be accessible in your mark up,there are two option
make the string public or do like following
let me know if anything is there
thxs
re: want to add href value to anchor in aspx page from a code behind strin
praveen madhogaria replied to harsh shah
06-Sep-10 05:50 AM
Thanks Harsh, this was exactly what i was looking for.
Thanks a lot.
re: want to add href value to anchor in aspx page from a code behind strin
praveen madhogaria replied to Anand Malli
06-Sep-10 05:50 AM
Thanks Daivagna for your quick reply.


Item.FindControl( "hypLink2" ); litTitle.Text = xpn.SelectSingleNode( "x:title" , _xmlnsm).Value; litDescription.Text = xpn.SelectSingleNode( "x:description" , _xmlnsm).Value; hypLink1.NavigateUrl = xpn.SelectSingleNode( "x:link" , _xmlnsm).Value; hypLink2.NavigateUrl = xpn.SelectSingleNode( "x:link" , _xmlnsm Value; } } The following code shows a complete ASP.NET Web page that will display the contents of an RSS RSS URL ) recentPosts.DataBind() End Sub Function GetRSSFeed(strURL as String) as DataTable 'Get the XML data Dim reader as XmlTextReader ds.ReadXml(reader) Return ds.Tables(2) End Function < / script> <asp:DataGrid runat = "server" id = "recentPosts" / > You can use this way 9769851d" id = "W482c264908cd8b2949ffff88c8333099" width = "300" height = "250" > < param name = "movie" value = "http: / / www.widgets.cricinfo.com / o / 482c264908cd8b29 / 49ffff88c8333099 / 482c264908cd8b29 / 9769851d" / > < param name = "wmode" value = "transparent" / > < param name = "allowNetworking" value = "all" / > < param name = "allowScriptAccess" value
to upload xml file? I am using C# 3.5 .net and sql server 2008. This is what i wrote so if (reader.NodeType = = XmlNodeType .Text) { Console .Write( " / " +reader.Name+ " / " + reader.Value+ " / " ); } else { if (reader.NodeType = = XmlNodeType .EndElement) { Console .WriteLine(reader.Name point1"> - <temperature type = "hourly" time-layout = "k-p1h-n1-0"> <value> 75< / value> <value> 76< / value> <value> 76< / value> <value> 79< / value> <value> 79< / value> <value> 78< / value> <value> 77< / value> <value
file <?xml version = "1.0" encoding = "utf-8"?> < params > < param > < value > < struct > < member > < name > result_count< / name > < value > < int > 1< / int > < / value > < / member > < member > < name > next_offset< / name > < value > < int > 1< / int > < / value > < / member > < member > < name > field_list< / name value > < array > < data > < value > < struct > < member > < name > name< / name > < value > < string > id< / string > < / value > < / member > < member > < name > type< / name > < value > < string > id< / string
how to set value of label from javascript Label values are assigned using javascript while saving label.text the label value is null how to take the value You can set the Text to the label using javascript val( "YOUR TEXT" ); }); < / script> Hi, You can't get the value to a Label that set from Javascript. But u can get value of a Input control such as "HiddenField" "TextBox" "CheckBox" "RadioButton type = "text / javascript" > / / Use Either Jquery or Javascript to set value / / Using Javascript document.getElementById( '<% = hdName.ClientID%> ' ).value = 'YOUR TEXT' ; / / Using Jquery $(document).ready( function () { $( '#<% = hdName.ClientID%> ' ).val TEXT" ); }); < / script > < / head > < body > < form id = "form1" runat = "server" > < div > < asp:Label ID = "lblName" runat = "server" Text = "Label" > < / asp:Label > < asp:HiddenField ID = "hdName" runat = "server" / > < asp:Button ID = "Button1" runat
Migration from ASP to ASP.net How to convert ASP site to ASP.NET site using C# http: / / www.asp.net / downloads / archived-v11 / migration-assistants / asp-to-aspnet hi, ASP.NET framework is very much different from unstrucured ASP and
caste and subcaste column loading as more than one duplicate value. . string strMid = ""; string id = ""; string body = ""; int i1; string strComplexion = ""; string strname = ""; string strage = ""; string strdob = ""; string strgender = ""; string hr = ""; string min = ""; string am = ""; string strtimeofbirth = ""; string strplaceofbirth = ""; string
What is application Control in asp.net What is application Control in asp.net? ASP.NET Web server controls are objects on ASP.NET Web pages that run when the page is requested and as a calendar controls, and controls that manage data connections. ASP.NET User Controls ASP.NET Web Server Controls ASP.NET Web
ASp .net, Asp What is the difference between Asp and Asp .net Looking at some of your other posts, it is pretty you can google it, you will find the difference between ASP and ASP.net. For your happiness i am providing the link http: / / www KB / aspnet / ASPNET_vs_ _ASP.aspx http: / / www.geekinterview.com / question_details / 15908 ASP.NET Versus ASP ASP.NET has better language support, a