I've created a unbound column in my WebHierarchicalDataGrid.
Now I'd like to show a button in this column and perform an action in code when the user clicks the button.
I get the impression I need to set the type on the column?
Like... WebHierarchicalDataGrid1.Bands[1].Columns[0].Type = ???
How do I accomplish this?
Thanks.
So I was able to figure out how to know which row the button is in when I clicked on it.
protected void DeactivateNow_Click(object sender, EventArgs e)
{
Button btn = (Button)sender;
TemplateContainer parent = (TemplateContainer)btn.Parent;
GridRecordItem item = (GridRecordItem)(parent.Item);
//this returns the index of the row in the container
int indexRow = item.Row.Index;
GridRecordItem serialNumber = item.Row.Items.FindItemByKey("SerialNumber");
GridRecordItem machineCode = item.Row.Items.FindItemByKey("MachineCode");
GridRecordItem id = item.Row.Items.FindItemByKey("ID");
ShowPopUpMsg("SN:" + serialNumber.Text + "\nMC:" + machineCode.Text + "\nID:" + id.Text);
}
Hi David,
Thanks for the suggestion. I found this article to get me going in the right direction.
http://help.infragistics.com/NetAdvantage/ASPNET/2011.2/CLR4.0/
So, I was able to add the button to the column using a item template and now when I click on the button the event fires.
However, how do I know which row button the user clicked on?
The event has a sender that seems to be the button object.
Thanks,
Brian.
Hi demoend,The Type property is the actual type of bound data (like string, int, etc). If you want a button, I would suggest adding a TemplateDataField with an ItemTemplate that has a button in it. Then you could handle the client click of the button or the server side or handle an ItemCommand.
regards,David Young