473,766 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can i change a HyperlinkURL in a Template field in a GridView via

I have a gridview inside a content placeholder that has the first column as a
hyperlink. I changed it from a Hyperlinkfield to a Template field so I could
name the hyperlink control. I can't figure out how to reference it so I can
change the URL depending on which Stored procedure I bind to it during form
load.

Is there a way to change it URL via VB. This is in a content form within a
master page if that makes any difference.

Thank you in advance for your help.

J
Apr 1 '06 #1
1 1635
if you are trying to change the URL based on the data then you might find it
easier to add to your dataset a field indicating which URL to be used. You
would then databind it to the HyperLinkField like this:

<asp:hyperlinkf ield datatextfield=" UnitPrice" datatextformats tring="{0:c}"
datanavigateurl fields="URL, ProductID"
datanavigateurl formatstring="{ 0}?ProductID={1 }" headertext="Pri ce"
target="_blank" />

in the above syntax the URL (.e.g http://some.website.com) is saved in a
field named URL and the ProductID is a parameter to be passed in the
querystring to that URL. Notice how you can use the
datanavigateurl formatstring to compose the URL out of more than one field.

On the other hand if you wish to use a HyperLink server control within an
ItemTemplate then you can bind the data using the Eval statement:
<asp:HyperLin k ID=”hlLink1†ť runat=”server ” NavigateUrl=’ <%# Eval(“URL”) &
“?ProductID†ť & Eval(“Product ID”) %>’ Text =’<%# Eval(“UnitPri ce”)%>’/>
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Vear" wrote:
I have a gridview inside a content placeholder that has the first column as a
hyperlink. I changed it from a Hyperlinkfield to a Template field so I could
name the hyperlink control. I can't figure out how to reference it so I can
change the URL depending on which Stored procedure I bind to it during form
load.

Is there a way to change it URL via VB. This is in a content form within a
master page if that makes any difference.

Thank you in advance for your help.

J

Apr 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
13753
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should always confirm a delete action. There is also a consensus that the best way to do this is a template...
0
1497
by: Yog | last post by:
Hi, How to access the value of a Texbox column(Template field) in gridview and to update a column next to it in the Gridview...! Example:Let's say there are four columns Product,Cost,Quantity Required(Textbox type template field in Gridview) and Total...! Totla shud get updated by Cost*QuantityRequired as soon as the user focuses on next row in the gridview.....!
2
7225
by: hazz | last post by:
Given the update query UPDATE Columns SET Include_in_Report = @Include_in_Report WHERE (ID = @Original_ID); Include_In_Report is a bit field in the table, represented as a checkbox on the grid. If someone clicks on the checkbox, I would like the bit field in that row in the database table to be updated immediately. I don't want to have to first
2
3598
by: Chris Davoli | last post by:
How do you enable a check box in the GridView. I selected Checkbox Field in the Columns of the GridView, and the check box shows up in the Grid view, but it is disabled. How do I enable it so I can check/uncheck it. Also, what event do I use to check it for a value? Any articles out there? -- Chris Davoli
4
6731
by: Chris Davoli | last post by:
I've got two questions on how to do things in the new GridView. I'm used to the DataGrid in ASP 1.1, so I need the equavalent in ASP 2.0 Gridview. 1.) What is the equavalent for Item Command event in GridView? I thought it would be RowCommand, but I can't get that event to fire with a check box field that I drag/drop in a template column in the ItemTemplate. 2.) For a Templated column, like a check box above, where do I tell it the...
4
7253
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which - "Modified" of type DateTime - is hidden since it should not be edited by a user. The system handles the update for this column. So, I have hidden (Visible=false) this column on the grid. In order to access the value in this field, I have created a...
3
7500
by: =?Utf-8?B?Um9iZXJ0IENoYXBtYW4=?= | last post by:
Hi, I have a GridView with a fixed number of columns being returned from a SQL query and each having a simple template: <asp:TemplateField HeaderText="Allocations"> <edititemtemplate> <asp:TextBox id="txt89" runat="server" Text='<%# Bind("89") %>' asp:TextBox> </edititemtemplate> </asp:TemplateField>
1
2463
by: cooldude | last post by:
I have a gridview component and it has a template field associated with it. However when I used gridview.Cells.Text it is null or balnk. Also the template field has not control associated with it here is the code: <asp:TemplateField HeaderStyle-Width="1000px" HeaderStyle-Wrap="true" ItemStyle-Width="200" ItemStyle-HorizontalAlign="Center" HeaderStyle-CssClass="Header" > <HeaderTemplate>
11
4079
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved, CrtdUser and Date And Edit and Delete buttons
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.