createchildcontrols fires before click event

Discussion in 'ASP .Net Web Controls' started by hsnkamal, Jun 26, 2007.

  1. hsnkamal

    hsnkamal Guest

    i have developed a web part using class library.when i clicked a
    button it displayed a datagrid.after that i want to edit it.when i
    click a edit button it goes to the original position where i the last means the grid is not visible.when i press a gain that
    button it is visible again?can anyone help me to solve this matter?
    hsnkamal, Jun 26, 2007
    1. Advertisements

  2. hsnkamal

    Tom John Guest


    You need to ensure that the Grid is created/displayed on every postback.

    I am guessing you are creating/displaying the Grid only after the button is
    clicked. Maybe set a flag in the ViewState to indicate whether the Grid
    should be displayed or not and query that when creating the child controls as
    to whether it should be displayed or not. Then use the button click event to
    set the ViewState flag.

    Hope this helps get you going. If you want a code sample, post what you've
    got and I'll help out.


    Tom John
    Tom John, Jul 4, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.