The user control event cannot be triggered?

Source: Internet
Author: User
A user control is written, and the user control contains a DataGrid.
The columns in the DataGrid are dynamically generated (including an editcommandcolumn ). Then an editcommand event is added to the DataGrid for processing. Program. You can edit the data of the current row when you click editcommandcolumn.

Run and click editcommandcolumn. No response is returned. After tracking, the editcommand event handler was not triggered. Strange thing !!!

We thought it was the reason why the DataGrid was created dynamically. Finally, we can find out the problem of loading the user control (the Dynamically Loaded control needs to be forcibly converted ):
Original statement:
Control TMP = (page. loadcontrol ("testcontrol. ascx "));
Phldtest. Controls. Add (TMP );
Modified statement:
Testcontrol TMP = (testcontrol) page. loadcontrol ("testcontrol. ascx "));
Phldtest. Controls. Add (TMP );

Refer:
Http://p2p.wrox.com/topic.asp? Topic_id = 7114

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.