gpt4 book ai didi

c# - 在 gridview 链接按钮上打开 ajax 模式弹出窗口

转载 作者:太空宇宙 更新时间:2023-11-03 19:13:14 24 4
gpt4 key购买 nike

我试图在 GridView LinkBut​​ton 上打开一个 ModalPopup,但是当我将 LinkBut​​ton ID 提供给弹出窗口的 targetcontrolid 时,它不接受。请帮助我。

<asp:GridView ID="grdView" runat="server" AutoGenerateColumns="False" CellPadding="0"
ForeColor="#333333" GridLines="None" onrowdatabound="grdView_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="Dr. Photo">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" Style="height: 80px; width: 100px;" ImageUrl='<%# String.Format("~/Upload/Docters/" + Eval("ImgName")) %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="150px" >
<ItemStyle Width="150px"></ItemStyle>
</asp:BoundField>

<asp:BoundField DataField="Qualification" HeaderText="Qualification"
ItemStyle-Width="50px" >
<ItemStyle Width="50px"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Click to Contact">
<ItemTemplate>
<asp:LinkButton ID="popup" runat="server" Text="Click to Contact"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

<ajaxToolKit:ModalPopupExtender id="ModalPopupExtender1" runat="server"
cancelcontrolid="btncancel" okcontrolid="btnSend"
targetcontrolid="Button1" popupcontrolid="Panel1"
popupdraghandlecontrolid="PopupHeader" drag="true" backgroundcssclass="ModalPopupBG">
</ajaxToolKit:ModalPopupExtender

最佳答案

我正在放置我的代码它会起作用

<asp:GridView ID="gvproducts" runat="server" DataKeyNames="sno,"  AutoGenerateColumns="false"  
OnRowCommand="gvproducts_RowCommand" OnPageIndexChanging="gvproducts_PageIndexChanging"
AllowPaging="true" PageSize="10" EmptyDataText="No Record Found" Width="100%"
BorderColor="#BDBDBD" HeaderStyle-BackColor="#7779AF" HeaderStyle-ForeColor="White" >
<Columns>
<asp:TemplateField HeaderText="SNo" FooterStyle-HorizontalAlign="Center">
<ItemTemplate>
<span>
<%#Container.DataItemIndex + 1%>
</span>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="indentid" HeaderText="Indent ID"></asp:BoundField>
<asp:BoundField DataField="productid" HeaderText="Product ID" ></asp:BoundField>
asp:BoundField DataField="productname" HeaderText="Product Name" ></asp:BoundField>
<asp:BoundField DataField="quantity" HeaderText="Quantity" ></asp:BoundField>
<asp:BoundField DataField="unit" HeaderText="Unit" ></asp:BoundField>
asp:BoundField DataField="requestby" HeaderText="Request By"></asp:BoundField>
<asp:TemplateField HeaderText="Purchase" ItemStyle-HorizontalAlign="Center">
ItemTemplate>
<asp:LinkButton ID="lnkPurchase" runat="server" CommandName="Purchase" CommandArgument="<%#Container.DataItemIndex%>"
ext="Purchase" ForeColor="blue">
</asp:LinkButton>
</ItemTemplate>
/asp:TemplateField>
</Columns>
</asp:GridView>

//模态弹窗

<input id="Hid_Sno" type="hidden" name="hddclick" runat="server" />
<ajaxToolkit:ModalPopupExtender ID="MPEPurchase" runat="server" TargetControlID="Hid_Sno"
PopupControlID="pnlpurchase" RepositionMode="RepositionOnWindowResizeAndScroll"
BackgroundCssClass="modalBackground" CancelControlID="btnxcancel" PopupDragHandleControlID="pnlpurchase" />

.CS

protected void gvproducts_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName.ToUpper() == "PURCHASE")
{
MPEPurchase.Show();
}
}

关于c# - 在 gridview 链接按钮上打开 ajax 模式弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18974518/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com