469,928 Members | 1,852 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,928 developers. It's quick & easy.

Are there issues with using Datagrids in a Usercontrol?

I have a Datagrid that is in a user control on a webform I am creating and
when I click on the edit button of the datagrid nothing happens. I have to
click the button 2 times to get the event to fire. I put a
Response.Write("The edit button has been pressed"); inside the event to
test, and the event does fire but the edit boxes are not shown. When the
edit button is clicked the second time the edit boxes show, but the update
event also fires

I put similiar Response.write lines in the Cancel and Update events so I
know that the Update is being fired by the second press of the button. Even
the Cancel button takes 2 clicks to make it work.

Here is the code:
private void Fill_DataGrid()


//Assign the driver id to the select query

sqlSelectCommand1.Parameters["@DriverID"].Value = DriverNum;

//Fill the Dataset


//Bind the data from the dataset to the grid for display



private void dgPreviousEmployers_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)


dgPreviousEmployers.EditItemIndex = e.Item.ItemIndex;

RequiredFieldValidator1.Enabled = false;

Response.Write("Edit button has been pressed!");


private void dgPreviousEmployers_CancelCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)


dgPreviousEmployers.EditItemIndex = -1;

Response.Write("Cancel button has been clicked!");


private void dgPreviousEmployers_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)


Response.Write("Update has been clicked!");

Nov 18 '05 #1
0 870

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by ProgramAnalyst | last post: by
4 posts views Thread by Don | last post: by
1 post views Thread by Lee Trotter | last post: by
reply views Thread by mark | last post: by
12 posts views Thread by Joe | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.