473,486 Members | 1,850 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

WebControls.DataGrid

I have a HyperLinkColumn inside my Databound grid on a page, I have been
using the URL Field property set to a field name in my bound data, and then
using the URL Format String as dbClientconn.aspx?searchID={0} and all works
perfectly, however I need to set this to have to fields values in the
string,
something like;

URL Field: ClientConnectionField, ClientCustomerRefField
URL Format String: dbclientconn.aspx?searchID={0}&custref={1}

However this does not work, it would appear you can only use one format
placing {0}. Can someone tell me if you can do it and how ?

Thanks

Martin
Nov 18 '05 #1
1 1798
You are correct.
You are limited to 1.
================================================== ==========
Here is how I get around it:
================================================== ==========
In my grid I use this:
================================================== ==========
<asp:TemplateColumn SortExpression="statustext" HeaderText="Status">
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:Hyperlink id="hylStatus" runat="server"></asp:Hyperlink>
</ItemTemplate>
</asp:TemplateColumn>

================================================== ==========
In my code behind I use this:

Private Sub dg_ItemDataBound(ByVal sender As System.Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg.ItemDataBound

If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then

'need to take paging into account!
Dim mIndex As Integer = CType(sender, DataGrid).PageSize *
CType(sender, DataGrid).CurrentPageIndex + e.Item.ItemIndex

'set Status hyperlink
Dim oHylStatus As HyperLink = CType(e.Item.FindControl("hylStatus"),
HyperLink)

'hide the link if the Status is "xyz", otherwise show it:
If myBizObj(mIndex).status = "xyz" Then
oHylStatus.NavigateUrl = ""
Else
'custom javascript function for opening a new window.
oHylStatus.NavigateUrl = "javascript:NewWin('ViewStatus.aspx?Key=" &
myBizObj(mIndex).key & "&Type=" & myBizObj(mIndex).type &
"','MyStatus',0,0,640,480);"
End If

oHylStatus.Text = myBizObj(mIndex).statustext
....
================================================== ==========
--
Joe Fallon

"Martin Dew" <re************************@adastra.co.uk> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
I have a HyperLinkColumn inside my Databound grid on a page, I have been
using the URL Field property set to a field name in my bound data, and then using the URL Format String as dbClientconn.aspx?searchID={0} and all works perfectly, however I need to set this to have to fields values in the
string,
something like;

URL Field: ClientConnectionField, ClientCustomerRefField
URL Format String: dbclientconn.aspx?searchID={0}&custref={1}

However this does not work, it would appear you can only use one format
placing {0}. Can someone tell me if you can do it and how ?

Thanks

Martin

Nov 18 '05 #2

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

Similar topics

5
5253
by: Sue | last post by:
On code-behind page: (attributes set programatically for each of these elements) linkbutton added to tablecell textbox added to tablecell tablecells added to tablerow tablerow added to table...
0
314
by: Nuno Monteiro | last post by:
Hello! Anyone knows how to add scroll bars in WebControls.DataGrid? -- Cumprimentos, Nuno Monteiro nuno@rcsoft.pt RCSoft - Desenvolvimento de Software, Lda. Telef: 239708708 Fax: 239708701
0
305
by: Nuno Monteiro | last post by:
Hello! I'm using a WebControls.DataGrid and I wanna allowpaging to show several pagins with a NextPrev mode selection The Query returns 8 Rows but only shows 1 page with 5 rows, and the page...
5
2585
by: martin | last post by:
Hi, I am using vb.net and visual studio 2003. I have dragged a table webcontrol onto the designer server and configured a few columns and cells in the editor for the table control. Next I...
3
2771
by: vcornjamb | last post by:
Hello, I am developing a web form that contains some buttons and a data grid which has as its last column link buttons that will delete the data associated with that row. Everything works fine,...
0
1476
by: I am Sam | last post by:
Ok whats wrong with my toolbar? When I debug I don't get an error message and the databinding is working correctly but the toolbar itself and the <iewc:ToolbarDropDownlist /> control isn't showing...
7
1330
by: Roger Moore | last post by:
Hi all, I have a beginner's question: If webcontrols are rendered to suit different browsers using different HTML syntax for each, how can I create a unified CSS stylesheet to them (using the...
0
2269
by: John Smith | last post by:
This is what I am trying to do: <asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:BoundColumn Visible="False" DataField="id" ReadOnly="True"...
0
3309
by: John Smith | last post by:
This is what I am trying to do: <asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:BoundColumn Visible="False" DataField="id" ReadOnly="True"...
0
7094
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,...
0
6964
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...
0
7173
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...
0
7305
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...
1
4863
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...
0
3066
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...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
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 ...
1
598
muto222
php
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.