单击gridview中的一行时,我想制作一个ModalPopupExtender。我花了很多时间。但没有成功。
有直接的方法吗?如果是的话,有人可以给我一个示例代码..
我认识到 ModalPopupExtender 需要一个按钮来执行。所以我试图在一个按钮中触发点击方法并弹出我的窗口..
但我收到以下错误消息。
"Error 43 'ASP.admin_creation_aspx' does not contain a definition for 'clickbtn' and no extension method 'clickbtn' accepting a first argument of type 'ASP.admin_creation_aspx' could be found (are you missing a using directive or an assembly reference?)"
以下代码是我尝试过的..
JavaScript
> <script type="text/javascript">
>
> function clickbtn() {
>
> var myButton = document.getElementById('btnHidden');
> myButton.click();
> }
>
> </script>
模态弹出扩展器
<asp:ModalPopupExtender ID="InquiryPopupControlExtender" runat="server" TargetControlID="btnHidden" PopupControlID="InquiryPanel" CancelControlID="btn_InquiryBack" DropShadow="True" BackgroundCssClass="modalBackground" DynamicServicePath="" Enabled="True">
GridView 中的 grdInquiry_SelectedIndexChanged
protected void grdInquiry_SelectedIndexChanged(object sender, EventArgs e)
{
lbl_inqDateTime.Text = grdInquiry.Rows[grdInquiry.SelectedRow.RowIndex].Cells[9].Text;
lbl_inqUserName.Text = grdInquiry.Rows[grdInquiry.SelectedRow.RowIndex].Cells[1].Text;
lbl_InqNic.Text = grdInquiry.Rows[grdInquiry.SelectedRow.RowIndex].Cells[2].Text;
lbl_InqProduct.Text = grdInquiry.Rows[grdInquiry.SelectedRow.RowIndex].Cells[3].Text;
lbl_InqInquiryType.Text = grdInquiry.Rows[grdInquiry.SelectedRow.RowIndex].Cells[4].Text;
lb_InqFacilityNo.Text = grdInquiry.Rows[grdInquiry.SelectedRow.RowIndex].Cells[5].Text;
lbl_InqDescription.Text = grdInquiry.Rows[grdInquiry.SelectedRow.RowIndex].Cells[8].Text;
//lbl_InqFullName.Text = grdInquiry.Rows[grdInquiry.SelectedRow.RowIndex].Cells[0].Text;
lbl_InqEmail.Text = grdInquiry.Rows[grdInquiry.SelectedRow.RowIndex].Cells[7].Text;
lbl_InqTelephone.Text = grdInquiry.Rows[grdInquiry.SelectedRow.RowIndex].Cells[6].Text;
grdInquiry.Attributes.Add("onchange", "return clickbtn();");
}
按钮事件
protected void btnHidden_Click(object sender, EventArgs e)
{
InquiryPopupControlExtender.Show();
}