我在updatepanel控件内的loginview中有formview,formview包含一个链接按钮。我必须将链接按钮注册为updatepanel触发器。
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="comments">
<h6>20 Diyo</h6>
<div class=" yorumat-div">
<asp:LoginView ID="loginYorumAtView" runat="server">
<LoggedInTemplate>
<asp:FormView ID="frmYorumAt" runat="server" DefaultMode="Insert" OnItemInserting="frmYorumAt_ItemInserting" DataSourceID="ods_YorumAt" >
<InsertItemTemplate>
<asp:TextBox ID="txtYorumAt" runat="server" CssClass="yorumat-txtbox" TextMode="MultiLine" Text='<%# Bind("Yorum_Text") %>'></asp:TextBox>
<asp:LinkButton ID="btnYorumAt" runat="server" CssClass="yorumat-button" CommandName="Insert" >Yolla</asp:LinkButton>
<asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="txtYorumAt" WatermarkText=" Yorum At ....">
</asp:TextBoxWatermarkExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" Display="None" ControlToValidate="txtYorumAt"></asp:RequiredFieldValidator>
</InsertItemTemplate>
</asp:FormView>
</LoggedInTemplate>
</asp:LoginView>
<asp:ObjectDataSource ID="ods_YorumAt" runat="server" InsertMethod="YorumEkle"
TypeName="yonet" DataObjectTypeName="Yorum"
oninserting="ods_YorumAt_Inserting" >
<InsertParameters>
<asp:QueryStringParameter DbType="Int32" Name="comment_post_idy" />
</InsertParameters>
</asp:ObjectDataSource>
</div>
<ul class="commentlist" >
<asp:DataList ID="datalistYorum" runat="server" DataSourceID="ods_yorumlar" ItemStyle-CssClass="commentlist" RepeatLayout="Table">
<ItemTemplate>
<li class="comment">
<div class="comment-body">
............<%# Eval("comment")%>...
</div>
</li>
</ItemTemplate>
</asp:DataList>
<asp:ObjectDataSource ID="ods_yorumlar" runat="server"
DataObjectTypeName="Yorum" TypeName="yonet" SelectMethod="PostYorumlariGetir"
ondatabinding="ods_yorumlar_DataBinding" onselecting="ods_yorumlar_Selecting">
<SelectParameters>
<asp:QueryStringParameter Name="comment_post_id" QueryStringField="post_id" Type="Int32" DefaultValue="2" />
</SelectParameters>
</asp:ObjectDataSource>
</ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
和后面的代码
protected void Page_Load(object sender, EventArgs e)
{
//LinkButton btnYorumAt = loginYorumAtView.FindControl("frmYorumAt").FindControl("btnYorumAt") as LinkButton;
FormView frmYorumAt = (FormView)loginYorumAtView.FindControl("frmYorumAt");
LinkButton btnYorumAt = (LinkButton)frmYorumAt.FindControl("btnYorumAt");
ScriptManager.GetCurrent(Page).RegisterAsyncPostBackControl(btnYorumAt);
}
错误:使用新关键字创建对象实例很快无法访问链接按钮请帮助我谢谢