views:

51

answers:

2

i have a button , this button makes a post back for the page(the normal case),, and i have an update panel contains some controls ..

when click the button the update panel is not affected by the button,and when adding trigger for this button on the update panel,, the other controls (which are not in the update panel)are n't affected ..

i want the effect of the button click appears for the controls on the update panels and the others ..

note :: i can't put the other controls in the update panel...

<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:&nbsp;<%#DataBinder.Eval(Container.DataItem, "FileName").ToString()%><br />
                                                File&nbsp;Size:&nbsp;<%#DataBinder.Eval(Container.DataItem, "ContentLength").ToString() + "&nbsp;bytes"%><br />
                                                <br />
                                                <br />
                                                </span>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </div>
                                    &nbsp;</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">
                                    &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <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>`

the update panel is:: updatepanel1

the button is: btn_update

+1  A: 

Don't know if i got your problem...

try this: set Mode="Conditional" and childrenAsTriggers="false" for the UpdatePanel that contains the Button (up1). Place the Controls that should be updated in an own UpdatePanel (up2), set Mode="Conditional" and ChildrenAsTriggers="false" as well.

Create a ClickHandler method for the button and use up2.update() to ensure that the correct updatepanel is updated.

p0wl
my button is n't in any update panel
maybe your source code would help...
p0wl
i edit my question
+1  A: 

After testing your code I still think my first answer should have solved the problem.

Delete the Triggers for the Update Panel. Set UpdateMode="Conditional" and ChildrenAsTriggers="false".

Create the ClickHandler methods for the buttons (e.g.:)

    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

the panel will be visible after the postback and the text of txt_objectiveSet, which is not in the updatepanel has changed as well.

p0wl
thank u so much ,, yeah it 's the answer,it fixes the problem ,,the problem was because another reason.