Hi,
In my application I would like to add a Button for each group header.
When the user clicks on the Button I want him to be able to insert a new record.
In order for the Insert to work I need to read an ID field value, which is used to Group the records (GroupID).
Here's what I have been able to get so far:
1.I was able to add button to GroupHeader in the Grid's ItemCreated event:
======
if (e.Item is GridGroupHeaderItem)
{
GridGroupHeaderItem groupHeader= (GridGroupHeaderItem)e.Item;
Button objButton = new Button();
objButton.CommandName = "Add";
objButton.ID = "Button_Add";
objButton.Text = "Add ";
groupHeader.Cells[0].Controls.Add(objButton);
}
====
2. Now when the User Clicks on the Button I can get the GroupHeaderItem for which the Button was clicked by interception the ItemCommand Event.
3.I used the FireCommandEvent("InitInsert", string.Empty); to get the Insert input boxes. One problem here is that the Inser section comes on the Last page of the Grid (Paging enabled) can this be fixed?
4. My Main concern is that I am not able to get the GroupID (field in my DB) that is used in GridGroupByField at design time.
I need this value to be able to insert the record. Is there a way to do this?
I can get this value from the GroupHeader or from any Row in the Group, where the Button was clicked.
Thanks for your help.
-Brenda
In my application I would like to add a Button for each group header.
When the user clicks on the Button I want him to be able to insert a new record.
In order for the Insert to work I need to read an ID field value, which is used to Group the records (GroupID).
Here's what I have been able to get so far:
1.I was able to add button to GroupHeader in the Grid's ItemCreated event:
======
if (e.Item is GridGroupHeaderItem)
{
GridGroupHeaderItem groupHeader= (GridGroupHeaderItem)e.Item;
Button objButton = new Button();
objButton.CommandName = "Add";
objButton.ID = "Button_Add";
objButton.Text = "Add ";
groupHeader.Cells[0].Controls.Add(objButton);
}
====
2. Now when the User Clicks on the Button I can get the GroupHeaderItem for which the Button was clicked by interception the ItemCommand Event.
3.I used the FireCommandEvent("InitInsert", string.Empty); to get the Insert input boxes. One problem here is that the Inser section comes on the Last page of the Grid (Paging enabled) can this be fixed?
4. My Main concern is that I am not able to get the GroupID (field in my DB) that is used in GridGroupByField at design time.
I need this value to be able to insert the record. Is there a way to do this?
I can get this value from the GroupHeader or from any Row in the Group, where the Button was clicked.
Thanks for your help.
-Brenda