Saturday, March 24, 2012

web datagrid

Hi,
In the web datagrid property builder there is a url field that you can set the ID to pass. This seems that you can only use one field to pass the value of. How could one pass more than one parameters in this property builder

For example using the id field in the url field in the property builder the url that gets created is something like http://local/machinea/default.aspx?id=2

Notice that only one parameter is being paased.

Can the property builder produce something like http://local/machinea/default.aspx?id=2&date=23/06/2003

Notice that now there are two parameters.

ThanksYou can achieve this by using an ItemTemplate Column.
Example:

You want to pass and EmployeeID and EmployeeName to a javascript function from a datagrid.

In the HTML of the DataGrid

<asp:TemplateColumn HeaderText="Select">
<HeaderStyle CssClass="HEADERSTYLE"></HeaderStyle>
<ItemStyle HorizontalAlign="Left"></ItemStyle>
<ItemTemplate>
<a href='<%# GetClientSideChooseEmployeeFunction(DataBinder.Eval(Container,"DataItem.EmployeeID").toString(), DataBinder.Eval(Container,"DataItem.EmployeeName").toString()) %>'>Select</a>
</ItemTemplate>
</asp:TemplateColumn>

The GetClientSideChooseEmployeeFunction in the code behind

Public Function GetClientSideChooseEmployeeFunction(ByVal EmployeeID As String, ByVal EmployeeName As String) As String
Return "javascript:ChooseEmployee(""" & EmployeeID & """,""" & EmployeeName & """);"
End Function

Hope this helps.

0 comments:

Post a Comment