我有一个按钮,这个按钮为页面发回一个帖子(正常情况下), 我有一个更新面板包含一些控件..
单击按钮时,更新面板不受按钮影响,并且在更新面板上为此按钮添加触发器时,其他控件(不在更新面板中)不受影响.. < / p>
我希望更新面板和其他控件上的控件显示按钮单击的效果。
note ::我无法将其他控件放在更新面板中......
<asp:Panel ID="pnl_masterCourse" runat="server" style="text-align: left">
<asp:Label ID="lbl_allCourses" runat="server" CssClass="subtitle" Text="all courses:"></asp:Label>
<br />
<br />
<asp:GridView ID="gv_assignCourseToProgram" runat="server"
AutoGenerateColumns="False" DataKeyNames="courseCode"
DataSourceID="ObjectDataSource1" HorizontalAlign ="Center"
onrowcommand="gv_assignCourseToProgram_RowCommand" >
<Columns>
<asp:TemplateField HeaderText="#" SortExpression="courseCode">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("courseCode") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lbl_courseCode" runat="server" Text='<%# Bind("courseCode") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="credit hours" SortExpression="creditHours">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("creditHours") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("creditHours") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="objective set">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("objectiveSet") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("objectiveSet") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="english title" SortExpression="englishTitle">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("englishTitle") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("englishTitle") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="english objective">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server"
Text='<%# Bind("englishObjective") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("englishObjective") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete" ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"
CommandArgument="<%# Container.DataItemIndex%>" CommandName="Delete"
Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Select" ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
CommandArgument="<%# Container.DataItemIndex%>" CommandName="Select"
Text="Select"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DeleteMethod="Delete" InsertMethod="Add" SelectMethod="GetAllCourses"
TypeName="Managers.Course">
<DeleteParameters>
<asp:Parameter Name="CourseCode" Type="String" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="courseCode" Type="String" />
<asp:Parameter Name="prequisites" Type="String" />
<asp:Parameter Name="creditHours" Type="Int32" />
<asp:Parameter Name="objectiveSet" Type="String" />
<asp:Parameter Name="contentSet" Type="String" />
<asp:Parameter Name="courseFile" Type="String" />
<asp:Parameter Name="type" Type="Int32" />
<asp:Parameter Name="arabicTitle" Type="String" />
<asp:Parameter Name="englishTitle" Type="String" />
<asp:Parameter Name="arabicDesc" Type="String" />
<asp:Parameter Name="englishDesc" Type="String" />
<asp:Parameter Name="arabicObjective" Type="String" />
<asp:Parameter Name="englishObjective" Type="String" />
<asp:Parameter Name="arabicReferenceBooks" Type="String" />
<asp:Parameter Name="englishReferenceBooks" Type="String" />
<asp:Parameter Name="arabicTextBook" Type="String" />
<asp:Parameter Name="englishTextBook" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<br />
</asp:Panel>
<asp:Panel ID="pnl_courseDetails" runat="server">
<table class="Alternating">
<tr>
<td colspan="2">
<asp:ValidationSummary ID="ValidationSummary1" runat="server"
BackColor="#FFCCFF" DisplayMode="List" Font-Bold="True"
Font-Names="Arial Black" Font-Size="Larger" style="text-align: left" />
<asp:Panel ID="pnl_messages" runat="server" BackColor="#FFCCFF"
BorderColor="#CCCCCC" BorderWidth="0px" Font-Names="Arial" Font-Size="Large"
Height="26px" style="margin-top: 1px" Visible="False">
<asp:Label ID="lbl_message" runat="server" Font-Bold="True" Font-Names="Arial"
Font-Size="Large" ForeColor="Red"></asp:Label>
<br />
</asp:Panel>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label17" runat="server" CssClass="subtitle" Text="Course code:"></asp:Label>
<asp:Label ID="lbl_required" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:Label ID="lbl_courseNum" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label18" runat="server" CssClass="subtitle" Text="prequisites:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_coursePre" runat="server" Width="400px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label19" runat="server" CssClass="subtitle" Text="credit hours"></asp:Label>
<asp:Label ID="lbl_required0" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_creditHours" runat="server" Width="70px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txt_creditHours"
ErrorMessage="the credit hours must be entered.">*</asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToValidate="txt_creditHours"
ErrorMessage="the credit hours must be a whole value ."
Operator="DataTypeCheck" Type="Integer">*</asp:CompareValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label20" runat="server" CssClass="subtitle"
Text="course title(A):"></asp:Label>
<asp:Label ID="lbl_required1" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<cc1:ArabicTextBox ID="txt_arabicTitle" runat="server" Width="400px"></cc1:ArabicTextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="txt_arabicTitle"
ErrorMessage="the arabic title must be entered.">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" CssClass="subtitle"
Text="course title(E):"></asp:Label>
<asp:Label ID="lbl_required2" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_englishTitle" runat="server" Width="400px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="txt_englishTitle"
ErrorMessage="the english title must be entered.">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label6" runat="server" CssClass="subtitle"
Text="course description(A):"></asp:Label>
</td>
<td>
<cc1:ArabicTextBox ID="txt_arabicDesc" runat="server" Height="300px"
TextMode="MultiLine" Width="400px"></cc1:ArabicTextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label7" runat="server" CssClass="subtitle"
Text="course description(e):"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_englishDesc" runat="server" Height="300px"
TextMode="MultiLine" Width="400px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label8" runat="server" CssClass="subtitle"
Text="course objective(a):"></asp:Label>
</td>
<td>
<cc1:ArabicTextBox ID="txt_arabicObj" runat="server" Height="200px"
TextMode="MultiLine" Width="400px"></cc1:ArabicTextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label9" runat="server" CssClass="subtitle"
Text="course objective(e):"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_englishObj" runat="server" Height="200px"
TextMode="MultiLine" Width="400px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label10" runat="server" CssClass="subtitle"
Text="course reference books(a):"></asp:Label>
</td>
<td>
<cc1:ArabicTextBox ID="txt_arabicRefBooks" runat="server" Height="200px"
TextMode="MultiLine" Width="400px"></cc1:ArabicTextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label11" runat="server" CssClass="subtitle"
Text="course reference books(e):"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_englishRefBooks" runat="server" Height="200px"
TextMode="MultiLine" Width="400px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label12" runat="server" CssClass="subtitle"
Text="course text books(a):"></asp:Label>
</td>
<td>
<cc1:ArabicTextBox ID="txt_arabicTextBooks" runat="server" Height="200px"
TextMode="MultiLine" Width="400px"></cc1:ArabicTextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label13" runat="server" CssClass="subtitle"
Text="course text books(e):"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_englishTextBooks" runat="server" Height="200px"
TextMode="MultiLine" Width="400px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label14" runat="server" CssClass="subtitle" Text="content set:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_contentSet" runat="server" Height="200px"
TextMode="MultiLine" Width="400px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label15" runat="server" CssClass="subtitle"
Text="objective set:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_objectiveSet" runat="server" Height="200px"
TextMode="MultiLine" Width="400px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label16" runat="server" CssClass="subtitle" Text="course file:"></asp:Label>
</td>
<td>
<br />
<br />
<asp:Label ID="Label22" runat="server" CssClass="subtitle"
Text="View Course File:"></asp:Label>
<hr class="Alternating"
style="width :70%; text-align: left; background-color: #008000; height: 1px;" />
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="pnl_courseFile" runat="server" Visible="False">
<table class="AlternatingCenter" style="width: 100%">
<tr>
<td>
<asp:HyperLink ID="hl_courseFile" runat="server" CssClass="subtitle"
Font-Underline="True">course file</asp:HyperLink>
</td>
<td>
<asp:Button ID="btn_deleteCourseFile" runat="server"
onclick="btn_deleteCourseFile_Click" Text="Delete" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn_deleteCourseFile" EventName="Click" />
<asp:PostBackTrigger ControlID="gv_assignCourseToProgram" />
<asp:PostBackTrigger ControlID="btn_update" />
</Triggers>
</asp:UpdatePanel>
<br />
<br />
<asp:Label ID="lbl_noFiles" runat="server" Font-Bold="True" Font-Size="Medium"
ForeColor="Red" Text="no file assigned to this course." Visible="False"></asp:Label>
<br />
<br />
<asp:Label ID="Label21" runat="server" CssClass="subtitle"
Text="To replace Course File:"></asp:Label>
<hr class="Alternating"
style="width :70%; text-align: left; background-color: #008000; height: 1px;" />
<br />
<telerik:RadUpload ID="rupload_courseFile" Runat="server"
AllowedFileExtensions=".pdf,.doc,.docx" ControlObjectsVisibility="None"
Skin="WebBlue">
</telerik:RadUpload>
<telerik:RadProgressArea ID="progressArea2" runat="server" Skin="WebBlue">
<localization uploaded="Uploaded" />
</telerik:RadProgressArea>
<div>
<asp:Label ID="labelNoResults" runat="server">No uploaded files</asp:Label>
<asp:Repeater ID="repeaterResults" runat="server" visible="False">
<HeaderTemplate>
Uploaded files:<br />
</HeaderTemplate>
<ItemTemplate>
File: <%#DataBinder.Eval(Container.DataItem, "FileName").ToString()%><br />
File Size: <%#DataBinder.Eval(Container.DataItem, "ContentLength").ToString() + " bytes"%><br />
<br />
<br />
</span>
</ItemTemplate>
</asp:Repeater>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<table class="AlternatingCenter" style="width: 100%">
<tr>
<td>
<asp:Button ID="btn_update" runat="server" CssClass="subtitle" Text="Save"
Width="100px" onclick="btn_update_Click" />
</td>
<td>
<asp:Button ID="btn_reset" runat="server" CausesValidation="False"
CssClass="subtitle" Text="Reset" onclick="btn_reset_Click" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<asp:LinkButton ID="lbtn_viewAllCourses" runat="server"
CausesValidation="False" CssClass="subtitle" Font-Underline="True"
onclick="lbtn_viewAllCourses_Click">Back To All Courses</asp:LinkButton>
</td>
</tr>
</table>
<br />
</asp:Panel>
<br />
</td>`
更新面板为:: updatepanel1
按钮为: btn_update
答案 0 :(得分:1)
不知道我是否遇到了你的问题...
试试这个: 对于包含Button(up1)的UpdatePanel,设置Mode =“Conditional”和childrenAsTriggers =“false”。将应该更新的控件放在自己的UpdatePanel(up2)中,设置Mode =“Conditional”和ChildrenAsTriggers =“false”。
为按钮创建ClickHandler方法并使用up2.update()以确保更新正确的updatepanel。
答案 1 :(得分:1)
在测试代码后,我仍然认为我的第一个答案应该已经解决了问题。
删除更新面板的触发器。设置UpdateMode =“Conditional”和ChildrenAsTriggers =“false”。
为按钮创建ClickHandler方法(例如:)
Protected Sub btn_update_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_update.Click
txt_objectiveSet.Text = "text"
pnl_courseFile.Visible = True
UpdatePanel1.Update()
End Sub
在回发后面板将会显示,并且更新面板中没有的txt_objectiveSet文本也已更改。