Variable Inside Of The Markup For An Asp:HyperLink NavigationUrl Property?
Mar 9, 2010
I'm new to ASP.NET and can't figure out how to accomplish this...My code (that needs fixing):
<asp:HyperLink runat="server"
NavigateUrl="~/EditReport.aspx?featureId=<%= featureId %>" />
featureId gets defined as an integer in the backing code. I want href's like...
/EditReport.aspx?featureId=2224
...but instead I am getting...
/EditReport.aspx?featureId=<%= featureId %>
View 2 Replies
Similar Messages:
Mar 2, 2011
I have an asp.net repeater control with a series of asp:hyperlink's
<asp:HyperLink runat="server" ID="name" NavigationUrl="~/Pages/display.aspx?fileid={0}&user={1}" />
and then on the OnItemDataBound method:
fullname.NavigationUrl=string.Format(name.NavigationUrl, user.fileid, user.userid);
So that gives me a series of URLs in the repeater:
[URL]
OK, so with a simple proxy tool someone can replace either of the parameters with some OTHER number to get access to what they shouldn't see.
server-side validation and authentication aside, is there a better method other than passing parameters when trying to create a dynamic URL within a repeater?
View 2 Replies
Jul 12, 2010
I have repeater in which I have 2 hyperlink in the footer of the repeater and I want that the hyperlink can navigate from the page_load
View 2 Replies
Dec 31, 2010
private ListDictionary parameters;
public ListDictionary Parameters
{
get
{
if (parameters == null) parameters = new ListDictionary();
return parameters;
}
set
{
if (parameters == null) parameters = new ListDictionary();
parameters = value;
}
}
can i set such property in the markup of ASP.NET page? and how?
i mean something like <uc1:CustomControl Parameters="?"
View 2 Replies
Oct 26, 2010
I am using an asp.net/c# datalist.
<asp:DataList ID="EquipmentList" RepeatColumns="5".....
I have the following line inside the <ItemTemplate> tag:
<a href=""><%# {I want to put something here but dont know how} %> </a>
In my code behind I have a NameValueCollection variable that contains all strings:
NameValueCollection myListofStrings = //calling a method here that populates myListofStrings
this.EquipmentList.DataSource = myListofStrings;
this.EquipmentList.DataBind();
can someone tell me how to bind this NameValueCollection variable to my datalist tag in the markup? Also additional knowledge on how to bind a datalist to a dataset, sqldatareader, IList<>
but for now what do I write inside the tag if lets say i HAVE to bind to a NameValueCollection variable like in my case above. It has no properties or columns so I cannot write anything like Eval("propertyname") which is the answer that most here gave me. It is just like I am binding it to an array of strings. So what do I write now?
View 3 Replies
Sep 3, 2010
Is there a way that I can extend asp.net to accept the markup
<c:MyControl runat="server" MyList="1,2,6,7,22" />
Where MyList is a List<int> or List<string> or even List<someEnum>?
So I want asp.net to parse automatically all lists (that can be parsed) generically.
I know I could take the way around it and make MyList a string, then parse that into a list, but then I just end up with more properties than I want tbh.
View 1 Replies
Feb 2, 2010
I've seen various controls in ASP.NET with "collections" of objects, which you can use markup to define. For example:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp
/Triggers>
</asp:UpdatePanel>
In the above example, you can add any number of triggers, and they can be of any type that extends UpdatePanelTrigger. I'd like to do something similar, but with only a single item instead of a collection
View 2 Replies
Feb 25, 2010
I have a CheckBoxList in my page, with the DataTextField and DataValueField attributes set, is there an attribute that I can use to specify a property that indicates if it should be checked?
I'm hoping to just set the datasource, and not have to have any code behind to set the checked property. Possible?
View 1 Replies
May 19, 2010
I have an ASCX that inherits from a WebControl that has a 'CustomConfiguration' property of type CollectionConfigurationItem. This configuration gets set elsewhere in the code, so by the time it gets to the ASCX it is set up to how I wish to use the data. At this point I'd like to render out another control using this configuration, like so:
<modules:DataModule runat="server" CustomConfiguration="<%# Model.CategoryListConfiguration %>" />
However, breaking into DataModule always results in 'CustomConfiguration' being null, which is the default value for the property. I've tried adding a Bindable attribute to the property but to no avail, and when I set an EventHandler for the DataBinding event on the DataModule it doesn't even get called.
How can I set this custom-class-typed property from the markup or, failing that what's the second-best method of getting this to work?
View 1 Replies
Sep 8, 2010
Is it possible to use a session variable in the markup aspx page ?
Cause I have a gridview that use an sqldatasource and in the UpdateCommand I want to include a the session variable : session("username").
Ex :
UpdateCommand="UPDATE departments SET DEP_name = @DEP_name, DEP_active = @DEP_active, DEP_date_stamp = CONVERT (CHAR(8), GETDATE(), 112) + ' ' + CONVERT (VARCHAR(8), GETDATE(), 108),
DEP_user_stamp = <% session("username") %> WHERE (DEP_mnc = @original_DEP_mnc)">
This give me an error :
Server tags cannot contain <% .... %> constructs.
View 5 Replies
Dec 29, 2010
I'm new to custom server controls and I'm hoping to use them to build various 'modules' for different sites I build to cut down on duplicate code.I'm familiar with custom user controls in which I can create an .ascx & .ascx.vb file which can then be imported into an .aspx page and used freely.However, with custom server controls I cannot find a way of using markup/html code. Is this possible at all or must all code be created programmatically?
View 1 Replies
Jan 21, 2010
I created a UserControl and added a public DateTime property. I want to set this property in Markup (ie. <cc1:MyControl runat="server" id="MyControl1" DateTimeProp="1/1/2010" /> ) however I live in a place with a dd/mm/yyyy date format so it complains if I set something like "20/1/2010". Is there a way to set markup in my local datetime format or do I have to conform to "mm/dd/yyyy"?
View 2 Replies
Sep 29, 2010
I have a main_menu.ascx web control placed in my root and contains my website navigation menu with NavigationURL to the pages
I have my root files and I included the ascx file there Until here, I have no issue Now!
I have sub folders in my root and I want to include same ascx file because I don't want more than one main_menu file!
But the problem here is with the NavigationURL because it will be different when the aspx file is in sub folder
How can make sure my NavigationURL is referring to the correct path whether aspx in root or in sub folder?
View 1 Replies
Aug 3, 2010
I'm sure I've done this before, but can't remember the syntax. How do I include a session variable in nagivateUrl in a hyperlink?
I've tried this:
<asp:HyperLink ID="lnkMyLink" runat="server" Text="My Link"
NavigateUrl='<%# "http://absoluteURL.org?param=" +
Session["myParameterValue"].ToString()%>'></asp:HyperLink>
and this:
<asp:HyperLink ID="lnkMyLink" runat="server" Text="My Link"
NavigateUrl='<%# String.Format("http://absoluteURL.org?param={0}",
Session["myParameterValue"].ToString()) %>'></asp:HyperLink>
View 2 Replies
Aug 27, 2010
<asp:hyperlinkfield
datatextfield="fldfsl"
datanavigateurlfields="fldfsl"
datanavigateurlformatstring="website1.aspx?para1=dtersaga"
/>
that works like predicted when i declare the variable for para1 but i need it to read the fldfsl and pull that and put it behind para1= like this (but does not work)
<asp:hyperlinkfield
datatextfield="fldfsl"
datanavigateurlfields="fldfsl"
datanavigateurlformatstring="website1.aspx?para1=fldfsl"
/>
View 2 Replies
Mar 22, 2010
I have a hyperlink column in a datagrid that uses DataNavigateUrlFormatString to open a popup window via javascript. I am trying to get two variables from a sql to show in the query string for the popup window. I am able to pass the sessionstart date which is ={0} but the other those two variables in the javascript I am not sure how to pass. The two are school_id and program_id in the select statement below:
strsql = "select count(z.iIndividualid) as enrolled,session_id,school_id as SchoolId,program_id as ProgramId,convert(nvarchar(10),session_start_date,101) as SessionStartDate, session_class_size as SessionClassSize from dbo.cnSchoolProgramSessions cn with
(nolock) left join customerproductdetail cpd on cn.session_start_date = cpd.dtdate1 left join customerproduct cp on cpd.iproductid=cp.iproductid and cp.iSiteId = cpd.iSiteId and cpd.tiRecordStatus = cp.tiRecordStatus left join individual z on z.iIndividualId
= cp.iOwnerId And z.tiRecordStatus = cp.tiRecordStatus where record_status = 1 and school_id = '" & iSchool & "' and program_id = '" & iProgram & "' group by session_id, school_id, program_id,session_start_date,session_class_size"
[Code]....
What do I need to pass in the hyperlink column to get the proper? Hopefully this makes sense to someone
View 1 Replies
Sep 4, 2010
I have 10 hyperlink controls. Depending on which hyperlink is pressed I want to pass a value to the target page. I think the easiest way would be to pass the value using URL of the hyperlink controls. Something like <asp:HyperLink ID="HyperLink1" NavigateUrl="~/News.aspx?id=>. I can pass just a value, but I want to pass a value from a variable.
<asp:HyperLink ID="HyperLink1" runat="server"
View 3 Replies
Dec 10, 2012
have been using hyperlink field and bind it using eval
NavigateUrl='Test.aspx?cid=<%# Eval("cat_id") %>' but it is not taking eval value.it is showing eval in link
View 1 Replies
Aug 29, 2010
Is there a way to do something like this:
<asp:HyperLink id="MyLink"
NavigateUrl="../mypage.aspx?id=<%= pageid %>"
runat="server">My Page</asp:HyperLink>
... except in a way that works?
I want to do this inline in a normal HyperLink control that is not databound.
Edit:
Got some good answers, but what I'm looking for is how to do this specifically in a normal HyperLink (not in a DataGrid/GridView) and inline (not via a function call or code behind).
View 2 Replies
Oct 4, 2010
<Template>
<asp:HyperLink runat="server" ID="HyperLink1" NavigateUrl='<%# string.Format("Tiff.aspx?ID={0}", Eval("ID")) %>' Target="_blank" Text="View" ></asp:HyperLink>
</Template>
I m getting an exception Like This..DataBinding: 'System.Collections.Hashtable' does not contain a property with the name 'ID'.
View 6 Replies
Jan 15, 2010
I query the database to get the VideoName and VideoURL of the videos held in my database (Videos saved on the file system with their location stored in the database) then bind the query results to a repeater with the following code
protected void Page_Load(object sender, EventArgs e)
{
// Variables declaration
string strConnString = ConfigurationManager.ConnectionStrings["vidConnectionString"].ConnectionString;
SqlConnection sqlConn = new SqlConnection(strConnString);
SqlCommand sqlcmd = new SqlCommand("SELECT [VideoName], [VideoURL] FROM [Video]");
SqlDataReader sqlReader;
sqlConn.Open();
sqlcmd.Connection = sqlConn;
sqlReader = sqlcmd.ExecuteReader();
VideoRepeater.DataSource = sqlReader;
VideoRepeater.DataBind();
sqlConn.Close();
}
and put a hyperlink into the repeater to list all the VideoName's this works fine but I want to pass the VideoURL to the next page I am using NavigateUrl="PlayVideo.aspx?VideoURL='<%# Eval("VideoURL") %>'" but when I try and load the Page I get the error saying The server tag is not well formed. the whole repeater code is
<asp:Repeater ID="VideoRepeater" runat="server" >
<ItemTemplate>
<asp:HyperLink ID="VideoLink" NavigateUrl="PlayVideo.aspx?VideoURL='<%# Eval("VideoURL") %>'" runat="server"><%# Eval("VideoName") %></asp:HyperLink>
</br>
</ItemTemplate>
</asp:Repeater>
I'm sure i've just got the hyperlink navigateURL wrong put not sure how else to pass the VideoURL variable
View 9 Replies
Jan 13, 2011
I have a string variable called pdfdestination which points to a file on another server. This string is "\\mars\IntranetUploads\pdf\testpdf1.pdf"; The following code doesn't work:
[Code]....
and the reason is that it won't just directly input that string into the address bar, but instead the path it tries to access begins at the root of my application. In other words, the resulting URL comes out like: [URL] I simply need the browser to directly access: \marsIntranetUploadspdf estpdf1.pdf
View 4 Replies
Jan 10, 2010
i have a a public property in my masterpage, I have a repeater on another page which has a hyperlink, when i click on it, i need to give the masterpage property a value based on the hyperlink clicked. How do i go about doing this, because at the moment the property is set to the last value in the repeater. I have something like this;
[Code]....
View 5 Replies
Mar 24, 2010
Well..the title sort of explains the problem..
I have a class that inherits the HyperLink-class, but I want to "hide" the CssClass-property from the intellisense and also from the "designer-view"..
I have tried the following:
[Code]....
View 1 Replies
Mar 10, 2010
Line 44, Column 69: there is no attribute "AlternateText" You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).
This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.
How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash. I can't figure this out.
View 2 Replies