嗨,我有一个用户控件,我想放在更新面板中,我的代码如下所示
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuestionControl.ascx.cs"
Inherits="ProcessFramework.QuestionControl" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:UpdatePanel ID="pnlUpdate" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="btnUpload" />
</Triggers>
<ContentTemplate>
<asp:DataList ID="QuestionList" runat="server" OnItemDataBound="QuestionList_ItemDataBound"
OnEditCommand="LinkButton1_EditCommand">
<ItemTemplate>
<div class="QuestionObject">
<asp:HiddenField ID="QuestionID" runat="server" Value='<%# Eval("QuestionID") %>' />
<span class="QuestionsLabel">
<h2>
<asp:Label ID="QuestionTextLabel" runat="server" Text='<%# Eval("QuestionText") %>'></asp:Label></h2>
</span>
<asp:Panel ID="LinkPanel" runat="server" Visible='<%# Eval("HasLink") %>' CssClass="QuestionsLink">
<asp:HyperLink runat="server" ID="QuestionLink" Text='<%# Eval("LinkText") %>' Target="_blank"
NavigateUrl='<%# Eval("LinkURI") %>'></asp:HyperLink>
</asp:Panel>
<br />
<asp:Panel ID="ResponseInputPanel" runat="server" Visible="false" CssClass="QuestionsText">
<asp:TextBox runat="server" Text='<%# Eval("Response") %>' TextMode="MultiLine" CssClass="TextArea"
ID="QuestionResponseTextBox">
</asp:TextBox><asp:HtmlEditorExtender ID="HtmlEditorExtender1" TargetControlID="QuestionResponseTextBox"
runat="server" EnableSanitization="false" DisplaySourceTab="true">
<Toolbar>
<asp:Undo />
<asp:Redo />
<asp:Bold />
<asp:Italic />
<asp:Underline />
<asp:StrikeThrough />
<asp:Subscript />
<asp:Superscript />
<asp:JustifyLeft />
<asp:JustifyCenter />
<asp:JustifyRight />
<asp:JustifyFull />
<asp:InsertOrderedList />
<asp:InsertUnorderedList />
<asp:CreateLink />
<asp:UnLink />
<asp:RemoveFormat />
<asp:SelectAll />
<asp:UnSelect />
<asp:Delete />
<asp:BackgroundColorSelector />
<asp:ForeColorSelector />
<asp:FontNameSelector />
<asp:FontSizeSelector />
<asp:Indent />
<asp:Outdent />
<asp:InsertHorizontalRule />
<asp:HorizontalSeparator />
<asp:Cut />
<asp:Copy />
<asp:Paste />
</Toolbar>
</asp:HtmlEditorExtender>
<div class="QuestionActions">
<asp:LinkButton ID="lnkClear" runat="server" Text="Clear" OnCommand="lnkClearA_OnCommand"
CommandArgument='<%# Container.ItemIndex %>' Visible="false">
</asp:LinkButton>
<label>
|</label>
<asp:LinkButton ID="LinkClearAll" runat="server" Text="Preview" OnCommand="lnkClearAllResponse_OnCommand"
CommandArgument='<%# Container.ItemIndex %>' Visible="false">
</asp:LinkButton>
<asp:Panel ID="AttachmentPanel" runat="server" Visible='<%# Eval("HasAttachment") %>'
CssClass="QuestionsAttachment">
<asp:Panel ID="AttachmentPanelUploadSection" runat="server" Visible='<%# (bool.Parse(Eval("IsAttachmentExist").ToString()) == false) %>'>
<asp:Literal ID="AttachFileLabel" runat="server" Text="Attach file (Max 10MB):" /><asp:FileUpload
ID="FileUpload1" runat="server" CssClass="button" />
<asp:Button ID="btnUpload" runat="server" Text="Upload" CssClass="button" OnCommand="btnUpload_OnCommand"
CommandArgument='<%# Container.ItemIndex %>' />
</asp:Panel>
<asp:Panel ID="AttachmentPanelFileInfoSection" runat="server" Visible='<%# Eval("IsAttachmentExist") %>'>
Attachment:
<asp:Literal ID="AttachementFileName" runat="server" Text='<%# Eval("AttachmentURI") %>'
Visible="true" />
<asp:LinkButton ID="RemoveAttachment" runat="server" CommandArgument='<%# Container.ItemIndex %>'
CssClass="imagelink" OnCommand="lnkRemoveAttachment_OnCommand" ToolTip="Remove"
Height="16px">
</asp:LinkButton>
</asp:Panel>
</asp:Panel>
</div>
</asp:Panel>
<asp:Panel ID="ResponseLabelPanel" runat="server" Visible="true">
<div class="QuestionsResponse">
<asp:Literal ID="ResponseLiteral" runat="server" Text='<%# Eval("Response") %>' />
</div>
<asp:LinkButton ID="LinkEditResponse" runat="server" Text="Edit" OnCommand="lnkEditResponse_OnCommand"
CommandArgument='<%# Container.ItemIndex %>'>
</asp:LinkButton>
<asp:Image ID="AttachmentIcon" runat="server" Visible='<%# (bool.Parse(Eval("IsAttachmentExist").ToString()) == true) %>'
ImageUrl="~/Content/Images/attachment.png" Width="14" Height="14" Style="float: right;
position: relative" />
<asp:LinkButton ID="LinkButton1" ToolTip="Download Attachment" runat="server" CommandName="Edit"
CssClass="linkbutton" Visible='<%# (bool.Parse(Eval("IsAttachmentExist").ToString()) == true) %>'
CommandArgument='<%# Eval("AttachmentURI") %>' Text='<%# Eval("AttachmentURI") %>' />
</asp:Panel>
</div>
</ItemTemplate>
<SelectedItemStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
<SeparatorTemplate>
<hr style="margin-top: 5px" />
</SeparatorTemplate>
</asp:DataList>
<asp:HiddenField ID="ObjID" runat="server" />
<br />
<table style="width: 200px;" align="right">
<tr>
<td>
<asp:Button ID="btnCancel" runat="server" CssClass="btn" OnClick="btnCancel_Click"
Text="Cancel" Visible="false" />
</td>
<td>
<asp:Button ID="btnSubmit" runat="server" CssClass="btn" OnClick="btnSubmit_Click"
Text="Save" Visible="false" />
</td>
</tr>
</table>
<br />
<br />
<hr />
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" Width="100%" HorizontalAlign="center"
OnPageChanged="AspNetPager1_PageChanged" PageSize="1" ShowPageIndexBox="Never"
AlwaysShowFirstLastPageNumber="true" PagingButtonSpacing="5" UrlPaging="false"
AlwaysShow="false" CssClass="paginator" CurrentPageButtonClass="cpb">
</webdiyer:AspNetPager>
</ContentTemplate>
因为我将文件上传控件放在更新面板中,所以我还设置了回发触发器,其中控件控件 id 作为我正在上传数据的单击按钮的 id 的 id。发生此问题是因为我将按钮放在控件中吗?任何机构都可以帮我解决这个问题吗?