|
Subject:
|
Problems passing values to a HyperlinkColumn
|
|
Posted By:
|
vshriniwasan
|
Post Date:
|
10/11/2004 3:02:51 AM
|
Hey guys, I am using BoundColumn and HyperlinkColumns to create a datagrid.
I have two boundColumns that provides me two values.
I am trying to pass those two values to the Hyperlinkcolumn to pass it as a querystring into a model window.
Note: I am doing this programmatically and have no HTML view to add a template.
Code:
For i = 0 To myDataSet.Tables(0).Columns.Count - 1
Dim dgColumn As New BoundColumn
Select Case myDataSet.Tables(0).Columns(i).ColumnName
Case "id" dgColumn.HeaderText = "Id" dgColumn.DataField = myDataSet.Tables(0).Columns(i).ColumnName dgWorkflow.Columns.Add(dgColumn)
Case "name" dgColumn.HeaderText = "Name" dgColumn.DataField = myDataSet.Tables(0).Columns(i).ColumnName dgWorkflow.Columns.Add(dgColumn)
End Select Next
Dim dgHColumn As New HyperlinkColumn dgHColumn.Text = "View" dgHColumn.NavigateUrl = "Javascript: alert('value1/value2')
How can i have each value in in row to be passed into the link.
If some one know how to work with iTemplate, may be they can give me a snipet to get me going...
Thanks,
Shrini
|
|
Reply By:
|
Santhi
|
Reply Date:
|
10/12/2004 12:01:33 AM
|
Here is the code snippet..It may help you
<asp:DataGrid autogenerateColumns=false> <Columns> <asp:TemplateColumn HeaderText="Type" > <ItemTemplate> <asp:HyperLink Runat="server" ID="Type" text=<%#DataBinder.Eval(Container.DataItem,"Type")%>> <%#DataBinder.Eval(Container.DataItem,"Type")%> </asp:HyperLink> </ItemTemplate> </asp:TemplateColumn> <asp:BoundColumn DataField="Participants" HeaderText="Number of Participants"></asp:BoundColumn> </Columns> </asp:DataGrid>
|