|
-
Jun 17th, 2005, 04:11 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] basic datagrid question
I'm just starting with datagrids.
I have to make a list of items. Each item will have a link. But I want the link of the item to have a custom value, not present in the dataset as an item.
All the essays I've found about asp.net, end up with:
datagrid.datasource = dataset
datagrid.databind()
Now, I need to add custom values to that link, ex: default.aspx?dsRow=4 , where the dsrow is the number of the row in the dataset.
How could I do that?
Thanks for reading,
HoraShadow
PS: I'm not double posting. I posted in the vb.net forum by mystake.
Last edited by HoraShadow; Jun 25th, 2005 at 04:02 PM.
-
Jun 20th, 2005, 06:24 AM
#2
Re: basic datagrid question
You can loop through the items in the ItemDataBound event. Here is a snippet from a page I'm working on:
VB Code:
Private Sub dgAddDeleteEmployees_ItemDataBound1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgAddDeleteEmployees.ItemDataBound
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
e.Item.Cells(2).Text = "<a class=""dgLinks"" href=""" & "EmployeeDetails.aspx?login=" & dt.Rows(e.Item.ItemIndex).Item("LoginId").ToString() & "&EmpName=" & dt.Rows(e.Item.ItemIndex).Item("EmpName").ToString() & "&Email=" & dt.Rows(e.Item.ItemIndex).Item("EmpMail").ToString() & """>" & Edit & "</a>"
End If
End Sub
-
Jun 25th, 2005, 04:00 PM
#3
Thread Starter
Fanatic Member
Re: basic datagrid question
Nice one!
Thanks mendhak.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|