0
有沒有辦法將控件(在gridview的模板字段中)設置爲模式彈出式擴展器的目標控件?我想喜歡這裏:如何將gridview模板字段設置爲模式彈出式擴展器的目標控件?
Full postback triggered by LinkButton inside GridView inside UpdatePanel
但我得到一個異常的值參數不能爲空。請詳細幫助。
網:
<asp:GridView ID="grdTemp" runat="server" AllowPaging="True" AllowSorting="True"
DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="TempNo" OnRowCommand="grdDULead_RowCommand" OnRowDataBound="grdDULead_RowDataBound">
<FooterStyle BackColor="White" CssClass="GridFooter" />
<Columns>
<asp:TemplateField><ItemTemplate><asp:LinkButton ID="grDULeadlnkSelect" runat="server" ForeColor="Red" OnClick="grDULeadlnkSelect_Click" CausesValidation="False" CommandName="selectrow">select</asp:LinkButton></ItemTemplate>
</asp:GridView>
擴展:
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="grDULeadlnkSelect" PopupControlID="pnlCDAMTClar" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
代碼隱藏: 在我得到了錯誤could not find control "grDULeadlnkSelect"
開始。然後,我試圖像這樣註冊按鈕,但我得到錯誤value cannot be null
。
protected void grdTemp_RowDataBound(object sender, GridViewRowEventArgs e)
{ // getting err at below line.
LinkButton lb = e.Row.FindControl("grDULeadlnkSelect") as LinkButton;
ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(lb);
}
你能告訴我們一些代碼嗎? – Shai
@Uneverno http://www.dotnetcurry.com/ShowArticle.aspx?ID=212 – Neha