Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
769
How to initialize a cell to call a .aspx modal on Link Button in asp.net 2.0 when the page first load up?
posted

Hello all,

 I have an ultrawebgrid that has many rows and many columns. On the Task column, I have embedded an asp.net 2.0 LinkButton and in there I have the link to open up a .aspx modal. The modal does opens up on the second click on the Link Button. After the first click it seems to initialize the link opens up the modal and after that when I tried to opens up the modal again on that same row, it will open up on the first click. And if I were to go onto the second row and click the link for the first time, it would not open up the modal, but on the second click, third click , and so on (on that second row), then it will open up the modal.

 So my question is, how do I initialize the link to the modal on either Page_Load, InitializeLayout or InitializeRow event methods. I have tried it on all three but none of them work because it cannot find the instance of my asp.net LinkButton.

It seems like, it will only initialize the modal link when it invoke the LinkButton1_Click event.

LinkButton1_Click (object sender, EventArgs e)

{

//Create an instance of the LinkButton

 LinkButton lnkButton = (LinkButton) sender;

//some javascript function

script = "javascript code here";

Page.ClientScript.RegisterStartupScript(typeof(Page), "modalDlg", script);

lnkButton.Attributes.Add("onClick", "doIt();");  // doIt(); is the javascript function from the "script" block two lines above

I have tried using FindControls ("LinkButton1") but it cannot find it in neither Page_Load, InitializeLayout or InitializeRow. 

If someone knows how to solve this, please shred some light on me.

 Thanks very much in advance!

Hs2 

 

Parents
  • 345
    posted

    Hi,

    If you don`t mind can you send code for me. last two weeks  iam tring to implemented same functionlities. but i can`t please help me. 

     

Reply Children