Get Row data in ItemCommand event
New DiscussionMy webdatagrid has a column of links. When the user clicks the link an ItemCommand event is fired. Within that event I would like to retrieve the data from the other bound columns. This is my markup:
<ig:WebHierarchicalDataGrid ID=”WebHierarchicalDataGrid1″ runat=”server”
Height=”600px” Width=”875px”
Key=”SqlDataSource1_DefaultView” DataMember=”SqlDataSource1_DefaultView”
DataSourceID=”WebHierarchicalDataSource1″ AutoGenerateBands=”False”
AutoGenerateColumns=”False” StyleSetName=”Windows7″ DataKeyFields=”DrNum”
onitemcommand=”WebHierarchicalDataGrid1_ItemCommand”
oninitializerow=”WebHierarchicalDataGrid1_InitializeRow”>
<Columns>
<ig:BoundDataField DataFieldName=”ID” Key=”ID” Hidden=”true”>
<Header Text=”ID” />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName=”DrNum” Key=”DrNum” Hidden=”true”>
<Header Text=”DrNum” />
</ig:BoundDataField>
<ig:TemplateDataField Key=”LastName”>
<Header Text=”Last Name” />
<ItemTemplate>
<asp:LinkButton ID=”LinkButton1″ runat=”server”
Text='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem,”LastName”) %>’
CommandName=”GetInfo” CommandArgument='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem,”ID”) %>’ />
</ItemTemplate>
</ig:TemplateDataField>
<ig:bounddatafield datafieldname=”FirstName” key=”FirstName”>
<header text=”First name” />
</ig:bounddatafield>
<ig:BoundDataField DataFieldName=”MiddleName” Key=”MiddleName”>
<Header Text=”M. Name” />
</ig:BoundDataField>
</Columns>
</ig:WebHierarchicalDataGrid>
This is my ItemCommand Event:
protected void WebHierarchicalDataGrid1_ItemCommand(object sender, Infragistics.Web.UI.GridControls.HandleCommandEventArgs e)
{
if (e.CommandName == “GetInfo”)
{
string ID = e.CommandArgument.ToString();
Infragistics.Web.UI.GridControls.WebHierarchicalDataGrid grid = (Infragistics.Web.UI.GridControls.WebHierarchicalDataGrid)sender;
//HOW DO I GET THE VALUES OF THE COLUMNS BELOW?
string tstrFullName = grid.Columns[“FirstName”].ToString() + ” ” + grid.Columns[“MiddleName”].ToString() + ” ” + grid.Columns[“LastName”].ToString();
}
}
The event is triggered and the e.CommandArgument is the ID of the row.
I need to get the values of the other columns. How do I do that?
THanks.