views:

176

answers:

2

Hi,
i am having a button on a modal pop up div. But i am not getting the click event of the button. I am calling this button inside a gridview. Whenever i call it outside the gridview it works perfect, but whenver i call it inside that gridview, it does not work. The popup window appears and disappears as desired buyt the click event of a button on it is not working. following is my code for calling javascript function from the javascript class.

lbtnReload.Attributes.Add("onclick", "SingleUpload('" + e.Row.Cells[1].Text + "')");
A: 

try this .... mention javascript

lbtnReload.Attributes.Add("onclick", "javascript:SingleUpload('" + e.Row.Cells[1].Text + "')");
Muhammad Akhtar
A: 

You should use the ClientClick event for this:

LinkButton b = new LinkButton();
b.OnClientClick = String.Format("javascript:SingleUpload('{0}')", e.Row.Cells[1].Text);

If you will provide whole code, we will help you much faster

VMAtm
this is the function that i am calling. Popup.showModal is in an external javascript file. When i use same code outside grid the button click on this works, but doesnt work in the grid <script type="text/javascript"> function SingleUpload(id) { Popup.showModal('modal'); return false; } </script>
pankaj
following is my div <div id="modal" style="border:3px solid black; background-color:#9999ff; padding:25px; font-size:150%; text-align:center;display:none;"> <table> <tr> <td> <asp:FileUpload runat="server" ID="fuSingleUpload" /> </td> <td> <asp:Button runat="server" ID="btnSingleUpload" Text="Upload" onclick="btnSingleUpload_Click"/> <asp:Button runat="server" Text="Submit" ID="Button1" onclick="btnSubmit_Click" /> </td> </tr> </table>Upload the image<br/><br/><a href="#" onclick="Popup.hide('modal')">close</a></div>
pankaj
i m using it as follows protected void gviewTemplate_RowDataBound(object sender, GridViewRowEventArgs e) { LinkButton lbtnReload = new LinkButton(); lbtnReload.CommandArgument = e.Row.Cells[12].Text; lbtnReload.CommandName = "reload"; lbtnReload.OnClientClick = String.Format("javascript:SingleUpload('{0}')", e.Row.Cells[1].Text); lbtnReload.Text = "Reload"; e.Row.Cells[1].Controls.Add(lbtnReload); }
pankaj
your suggestion did not work either
pankaj