By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,584 Members | 1,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,584 IT Pros & Developers. It's quick & easy.

Javascript postback onClick event missing from datagrid update button

P: 3
Before i get flamed, this isn't the usual question you see left right and center.

I'm dynamically creating usercontrols inside the page_init event and setting the ID's of each control so that the events survive postback. in the user control i have a datagrid which uses the old databinding events (updating, editing etc,...). Here's the problem, the editing event fires but the updating event doen't. Take a look -

This is the page_init event.

Expand|Select|Wrap|Line Numbers
  1.      protected void Page_Init()
  2.     {
  3.         if (!IsPostBack)
  4.         {
  5.             manager.PopulateProducts();
  6.         }
  7.         LoadProductControls();
  8.     }

LoadProducts looks like this -

Expand|Select|Wrap|Line Numbers
  1. UserControl productMasterDetail = (UserControl)LoadControl("~/controls/MasterDetailDropDown.ascx");
  3. Type controlType = productMasterDetail.GetType();
  5. PropertyInfo controlPropertyInfo = controlType.GetProperty("product");
  7. controlPropertyInfo.SetValue(productMasterDetail, p, null);
  9. productMasterDetail.ID = "crt-" +;
  11. PlaceHolder.Controls.Add(productMasterDetail);

Even more creepy, after having looked at the HTML i find that the datagrids update button does not have any onclick event but the cancel button does.

Expand|Select|Wrap|Line Numbers
  1. <input type="image" name="ctl00$ContentPlaceHolder1$crt-Solutions Platform Release v6.1$GridView$ctl02$ctl07" src="Images/UpdateBVT.png" alt="Update" style="background-color:Transparent;border-color:Transparent;border-style:None;border-width:0px;" />
  3. <input type="image" src="Images/CancelUpdate.png" alt="Cancel" onclick="javascript:__doPostBack('ctl00$ContentPlaceHolder1$crt-Solutions Platform Release v6.1$GridView','Cancel$0')" style="background-color:Transparent;border-color:Transparent;border-style:None;border-width:0px;" />

PLEASE HELP ME. i've already lsot my hair,...what's next?!!?!

Cheers in advance.
Sep 27 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.