当OnClientClick =“ShowPopup()时,弹出窗口显示并消失

时间:2014-09-25 21:26:30

标签: asp.net

当showpopup返回时它不会消失但没有值如果没有返回它显示并消失但是我再次点击它它显示了值但很快就消失了

<ItemTemplate>

                    <asp:Button ID="btndetails" runat="server"
                        CommandName="ShowPopup" OnClientClick="ShowPopup();return false  ;"

                        Text="select issue"  />
                </ItemTemplate>

背后的代码

 protected void GridView1_RowCommand(object sender,GridViewCommandEventArgs e)
{
    if (e.CommandName == "ShowPopup")
    {

        Button btndetails = (Button)e.CommandSource;
        GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer;
       // lblID.Text = HttpUtility.HtmlDecode(gvrow.Cells[3].Text);
      // lblID.Text = GridView1.DataKeys[gvrow.RowIndex].Value.ToString();
        lblID.Text = gvrow.Cells[2].Text;
       // lblContactName.Text = HttpUtility.HtmlDecode(gvrow.Cells[3].Text);
        //txtAddress.Text = gvrow.Cells[5].Text;
       // txtCity.Text = HttpUtility.HtmlDecode(gvrow.Cells[4].Text);

    }

1 个答案:

答案 0 :(得分:0)

OnClientClick属性将javascript onclick处理程序呈现到控件的HTML中。要了解这意味着什么,请尝试以下方法:

OnClientClick="alert('this is a javascript method, and will not execute in C#')"

你问题其余部分的语言相当混乱。你能澄清一下你想要完成的事情吗?