C# - Replace Href Value At Runtime?
Mar 18, 2011I have many A html tags in my master web page. I would like to replace their HREF values at runtime using code. How to do that? All a tags are tagged with runat="server".
View 5 RepliesI have many A html tags in my master web page. I would like to replace their HREF values at runtime using code. How to do that? All a tags are tagged with runat="server".
View 5 Repliesi want to change name of hyper link during runtime ,i put text box i take value from text box and put it as name of hyper link but when i reload page the original name of hyper link back again what i can i do to save the new value for ever.
View 2 RepliesI need to replace <span> entries in a string to legacy html code because it's going to be used in a report for Crystal Reports. <b> works with Crystal, but the<span>'s do not.
Here's the string which I'm trying to replace: <span style="font-weight: bold">%THIS CAN BE ANY TEXT%</span>. I want to replace it to
<b>%THIS CAN BE ANY TEXT%</b>.
[Code]....
Can anybody let me know the activex script for detecting .net runtime and directx runtime or any other way how can I detect this in any machine by from my web page ?
View 1 RepliesI have downloaded published (code behind files are no there, combined with dll in bin folder) web application from window server 2008 where it is hosted, & open it with visual studio when i debug that application it shows following error: "Colud not load assembly because this assembly is built by a runtime newer than the currently loaded runtime" I don't know how can i solve this problem and test application locally.
View 2 RepliesHow do you replace" with" using the replace method?
View 5 Repliesi set anchor tag in masterpage as
<a onmouseout="mclosetime()" onmouseover="mopen('m2')" id="AnchorText5" href="#">TEst</a>
but when i run application and it render the page the anchor tag contain href address like
<a onmouseout="mclosetime()" onmouseover="mopen('m2')" id="ctl00_AnchorText5" href="../MasterPages/#">TEst</a>
i also try to set the "#" from code behind but it again show href="../masterpages/#"
I have an ASP.NET 4.0 site that has links to another ASP.NET site (different domain name). In situations where users from domain 1 are directed to a page on domain 2, how would I setup a Javascript routine to create an href back to domain 1? That is, I don't want to place a solid <a> tag on domain 2 pointing back to domain 1. Rather, I need a little bit of script magic that only makes the href available to users coming from domain 1. specific Javascript library/widget that functions in this manner?
View 1 RepliesI am trying to stop XSS attack so I am using html agility pack to make my whitelist and Microsoft Anti-Cross Site Scripting Library to deal with the rest.
Now I am looking at encoding all html hrefs. I get a big string of html code that can contain hrefs. Accours to MS Library they have an URL encode but if you encode the whole URl then it can't be used. So in the example they just encode the query string
UrlEncode Untrusted input is used in a URL (such as a value in a querystring) Click Here!
[URL]
So now my questions is how do I parse through a href and find the query string. Is it always just "?" then query string or can it have spaces and be written in different ways?
Edit
This urls will not be written by me but the users who will share them. So that's why I need a way to make sure I get all query strings and not just ones in valid format. If it can work invalid format I have to grab these ones too. Hackers won't care if it is valid format or not as long as it still does what they want.
What I am trying to achieve is to use an Eval as parameter in my anchor tag's href. The anchor is nested inside a repeater, why I cannot use the code behind to achieve this.
I have tried a few things without any luck.
<a href="http://MyWebsite/ActiveUsers?ID=InsertEvalHere"><%# Eval("Name")%></a>
The following code below is what I have tried to do:
<a href="<% "http://MyWebsite/ActiveUsers?ID=" + DataBinder.Eval(Container.DataItem("ID"))%>"><%# Eval("Name")%></a>
<a href="<% "http://MyWebsite/ActiveUsers?ID=" + Eval("ID")%>"><%# Eval("Name")%></a>
<a href="http://MyWebsite/ActiveUsers?ID=<% DataBinder.Eval(Container.DataItem("ID"))%>"><%# Eval("Name")%></a>
<a href="http://MyWebsite/ActiveUsers?ID=<%# Eval("ID")%>"><%# Eval("Name")%></a>
None of the above seemed to be right, as I keep getting this error - The tag is not well formed.
How should I handle this?
I have a a grid view that one of its columns is a link field. this is my code to generate the link field. It worked with
a href, but not with HyperLink.
here is my code
<ItemTemplate>
<a href="CustomerDetails.aspx?CustomerId=<%#Eval("Customer_Id")%>" target ="_blank"><%#Eval("Customer_Id")%> </a>
</ItemTemplate> [code].....
I want to send the id value of tag to controller when user click on any link.
TempString1.Append("<li><a id="+aa[i].int_FeatureId+" href=../" + aa[i].Feature.vcr_LinkName + ">" + aa[i].Feature.vcr_FeaturesName + "</a></li>");
I've just started playing around with ASP.NET. I'm using the MVC model of ASP.NET. I'm working on creating the main master right now. I created most of my stuff with good old HTML, except for the ContentPlaceHolders. I created the hyperlinks with regular anchor tags. I created my various controllers and views for each of my main pages. In the anchor tags, I placed the URLs that would be used for in HTML. For example, I have a page called "Register", so I have a controller "RegisterController", then it's Index View. My question is: The code editor tells me it can't find the file in the href attribute. Is there a better way to do hyperlinks in ASP.NET, or do I just need to deal with those warnings?
View 4 RepliesI'm currently trying out the jqGrid plug-in. Everything is working well expect for sorting on a specific column. I have an existing table that I'm trying to apply the plug-in to.
<script type="text/javascript">
$(document).ready(function () {
tableToGrid("#myTable", {})
});
</script>
<table id="myTable">
<thead>
<tr>
<th>
Web Site
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href=[URL]
</td>
</tr>
<tr>
<td>
<a href=[URL]
</td>
</tr>
<tr>
<td>
<a href=[URL]
</td>
</tr>
<tr>
<td>
<a href=[URL]
</td>
</tr>
</tbody>
</table>
When I sort the column, the order comes up as Hello, Loblaws, Wahoo, Bob instead of Bob, Hello, Loblaws, Wahoo It looks like it is sorting the href tag and not the content. Very similar to this problem (just a different plug-in) - Table sorter issue with content
I have an aspx-Page with an anchor-tag. Itīs href has to take a parameter of thepage, which is a public member.public int CommissionId
{
get
{
//..
}
}
I know how to design the link in code-behind, but want to do it in Markup.I tried
<a href='<% String.Format(@"Details.aspx?commissionId=" + CommissionId) %>' runat="server" id="cancelLink" class="button" onclick="this.blur();"><span>Back</span></a>
I have created an image helper I call it , I see it but it is not clickable ,In the source view I c it as a href , but it is un clickable.
[Code]....
This is the helper in the view :
[Code]....
How to pass parameters from one page to another pages using a href.
<a href="#">
<a runat="server" id="link" href='ProductDetails.aspx?ID=<%# Eval("productID") %>'></a>
View 2 RepliesI have an entire web page stored in a string variable. I would like to remove all the <a href tags - everything from <a href= to </a> but making sure that all the other text stays intact. also I want to remove <input type=hidden to the > and <input type=submit to the >
View 2 RepliesWhat is the difference between @Href and HrefAttribute?
View 5 RepliesI am using a repeater control that is bind with a data reader. In <itemtemplate> i am trying to create a hyperlink that would be something like ....
[Code]....
but for some reason its not rendering the actuall value seems like some thing wrong with the concatination i am doing ...
How do I set Href to a file on a server (example: myserver esta.txt) correctly? When I assign the path to Href, it adds the domain name in front (http://mydomain.com/myserver/test/a.txt) which is not the correct path.
View 2 Repliesi want to ask why the is not working within the <asp:ListItem>? and what's the solution?
View 2 Replieshow to use <href> tag in asp.net Menu Control?? i have to open pop up pages.
View 1 RepliesI have the following HTML with a databinding expression as shown below:
[Code]....
The 'title' tag's expression gets evaluated fine.
But not the one in 'href' attrib of the 'link' tag. The HTML source generated shows the literal text "..this.BaseURL.../..."
Any idea what could be happening?