473,668 Members | 2,821 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple URL Fields in a datagrid

Hi there,

I have a datagrid that is bound to a datasource. The grid has a hyperlink
column and I want to generate the URL using the URL Field and URL Format
String fields in the Property Builder.

The problem I'm running into is trying to generate the URL with more than
one URL Field entry. I need to have more than field but I can't figure out
how to add more than one field in the URL Field textbox. Is it possible?

I would want the URL Format String to look something like...

MyURL.aspx?fiel d_1={0}&field_2 ={1}

Any help would be greatly appreciated.

Carlo.
Nov 18 '05 #1
1 2629
You can't do it using a normal bound column.
You need a template column.

Then in the dg_ItemDataBoun d event you create an instance of the hyperlink
and find it using FindControl and then set its properties.
In this case the dg is bound to a collection and the index of the collection
equals the index of the grid. So you can always identify whcih row you are
on.

=============== =============== =============== =============== ===========
<asp:TemplateCo lumn SortExpression= "myColumn" HeaderText="My Header">
<ItemTemplate >
<asp:Hyperlin k id="hylMyColumn "
runat="server"> </asp:Hyperlink>& nbsp;
</ItemTemplate>
</asp:TemplateCol umn>
=============== =============== =============== =============== ===========

Private Sub dg_ItemDataBoun d(ByVal sender As Object, ByVal e As
DataGridItemEve ntArgs) Handles dg.ItemDataBoun d
If e.Item.ItemType = ListItemType.It em OrElse e.Item.ItemType =
ListItemType.Al ternatingItem Then

'need to take paging into account!
Dim mIndex As Integer = CType(sender, DataGrid).PageS ize *
CType(sender, DataGrid).Curre ntPageIndex + e.Item.ItemInde x

'set hyperlinks values:
'Note: in the HTML the &nbsp; is required because the grid cells will
change shape w/o it when there is no data.

Dim ohylMyColumn As HyperLink =
CType(e.Item.Fi ndControl("hylM yColumn"), HyperLink)

ohylMyColumn.Na vigateUrl =
"javascript:Lef tSideWin('ViewS omePage.aspx?Ke y=" & mCollection(mIn dex).key &
_
"&KeyType=" & mCollection(mIn dex).keytype & "','MyScreen'); "

oHylInvNumber.T ext = mCollection(mIn dex).MyDescript ion

End If
End Sub
=============== =============== =============== =============== ===========
--
Joe Fallon


"carlor" <ca****@discuss ions.microsoft. com> wrote in message
news:61******** *************** ***********@mic rosoft.com...
Hi there,

I have a datagrid that is bound to a datasource. The grid has a hyperlink
column and I want to generate the URL using the URL Field and URL Format
String fields in the Property Builder.

The problem I'm running into is trying to generate the URL with more than
one URL Field entry. I need to have more than field but I can't figure out
how to add more than one field in the URL Field textbox. Is it possible?

I would want the URL Format String to look something like...

MyURL.aspx?fiel d_1={0}&field_2 ={1}

Any help would be greatly appreciated.

Carlo.

Nov 18 '05 #2

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

Similar topics

3
2574
by: Julio Sarmiento | last post by:
Can anyone help me???? I have a table that I need to get the sum of four individual fields and then rank them from highest to lowest total. After summing up the four fields individually and ranking them, I have to place them in a single datagrid. Example: Table: contains fields for Revenue, Quantity, Credit Apps, Accounts by rep (not my table!!!)
1
18243
by: Brian | last post by:
I have a dataset containing 2 tables. I need to fill a datagrid using data from both of these. If I could create a SQL Statement to fill the datagrid, it would look like this: SELECT fields.fieldname, fieldvalues.value FROM fields, fieldvalues I am having trouble finding documentation explaining how to populate
2
2325
by: Sky | last post by:
Hello: Another question about trying to wring functionality from a DataGrid... Have a DB table of "Contacts" -- 14 or more fields per record Show in datagrid -- but only 5 columns (First,Last, Fax, Phone, Category). Put an Edit column at the end... Now what?! If you go into Edit mode -- you can only edit 5 cells -- not all the rest of the Record's fields...not enough!
1
3279
by: Andrew | last post by:
Hey all, I am very new to ASP.Net (and .Net in general), but that isn't stopping the boss from wanting to begin new projects in it. This latest project has me kinda stumped and after a couple days of struggling, I figure asking you all (the experts) will keep me from going down some dark and dangerous road. The project I have is a fairly simple one, in theory anyway. The gist is to create a page where the user enters an IDNumber,...
3
2559
by: D. Shane Fowlkes | last post by:
Sorry for the length of this post. I have created a rather complex form which has a header/line item (parent and child records) structure. It's for an intranet. A screenshot can be seen here: http://www.drpt.virginia.gov/temp1.gif All the fields on this form have validation controls on them so they can not submit the form unless all fields are completed and some fall within a specified numeric range. When the form first is loaded,...
7
2460
by: Dave | last post by:
Hi, Maybe I'm missing something with the DataKeyField attribute of a datagrid but it seems that it's somewhat limiting since this only allows you to specify one field as the key. I have a table that has two keys and it seems you need this value to find the corresponding record in the DataSet in order to update the data from the Datagrid.
1
3344
by: Bob Loveshade | last post by:
I am looking for an example that shows how to select and highlight multiple rows in a DataGrid. My DataGrid is part of a Web User Control which is contained in an ASPX page. I haven't been able to find any examples which demonstrate how to do this. My Code:
8
10389
by: Jason L James | last post by:
Hi all, does anyone know if I can create a dataview from multiple datatables. My dataset is constructed from four separate tables and then the relationships are added that link the tables together. To make data entry easier I would like to combine selected columns from the four tables onto a single dataview that could be used as the datasource for a datagrid control. The distinct updates, insert ans delete
1
919
by: Beginner | last post by:
I am a newbie in ASP.NET. I am using VB.NET to write my codes. I have a project to be done this week but I am stucked on one thing. I want to make a datagrid of a form and display the form multiple times with the help of a query string. Like, the form has fields like First name, last name etc. If the querystring has '3' as value, I want to display the form 3 times and I want the data entered to go to a database. Can anybody help me by...
0
8462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8381
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
8893
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
8797
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8656
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5681
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
4380
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2791
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
1786
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.