UpdatePanel in a MasterPage not working

Last post 05-01-2007 8:38 AM by Aradia926. 2 replies.

Sort Posts:

  • UpdatePanel in a MasterPage not working

    04-30-2007, 4:21 PM
    • Member
      157 point Member
    • Aradia926
    • Member since 11-29-2005, 2:04 PM
    • Posts 35

    I've got a MasterPage that has an UpdatePanel in it that always does a full postback, and I can't figure out why.  I've checked all of the usual suspects and I DO HAVE a ScriptManager on the page before the UpdatePanel, and I have EnablePartialRendering set to true.  I use the UpdatePanel frequently in my Content Pages with no trouble. 

    In my UpdatePanel I have an ASP Panel, then a table that includes a radiobuttonlist, 2 dropdownlists one of which is populated during Page_Load and is visible while the other is not visible, and one blank textbox.  The dropdown that is populated during Page_Load is the one that triggers the postback with an SelectedIndexChanged event.  This event calls code that populates and displays the second dropdownlist while hiding the textbox. 

    I've tried everything that I can think of to find out why the UpdatePanel is totally ignored, and have found nothing.  Can someone help???

  • Re: UpdatePanel in a MasterPage not working

    04-30-2007, 4:49 PM
    • Participant
      892 point Participant
    • benpyle
    • Member since 03-27-2007, 3:21 PM
    • Tennessee
    • Posts 142

    Aradia,

    Are the controls that are triggering the update inside of the update panel? If not, then you will need some triggers and to set the update mode to conditional.  If this is not the answer, could you post your code?

    Regards 

    ~Ben
  • Re: UpdatePanel in a MasterPage not working

    05-01-2007, 8:38 AM
    • Member
      157 point Member
    • Aradia926
    • Member since 11-29-2005, 2:04 PM
    • Posts 35

    Ben,

    Yes, all of the controls that trigger an update are inside the same update panel.  Here is my code:

    1    <atlas:UpdatePanel ID="SearchUpdate" runat="server">
    2                            <ContentTemplate >
    3                        <asp:Panel runat ="server" ID="tblSearch" Height ="40px">
    4                            <table cellpadding="0" cellspacing="0" style="font-size: xx-small;
    5                                vertical-align: middle; font-family: verdana; height: 40px; background-color: #deeaf3;
    6                                text-align: right">
    7                                <tr style="height:45px;">
    8                                    <td style="width: 100px; height: 40px">
    9                                        <asp:RadioButtonList ID="RecordSelectList" runat="server" style="font:verdana; font-size :xx-small; font-weight:bold ;" AutoPostBack ="true" OnSelectedIndexChanged="RecordSelectList_SelectedIndexChanged" >
    10                                           <asp:ListItem Selected="True" Value="1">Contact</asp:ListItem>
    11                                           <asp:ListItem Value="2">Company</asp:ListItem>
    12                                       </asp:RadioButtonList></td>
    13                                       <td style="width: 100px; height: 40px; vertical-align:middle;">
    14                                       <asp:DropDownList ID="ddlSearchFields"
    15                                       runat="server" Width="155px" style="font :verdana; font-size :xx-small;" AutoPostBack="True" EnableViewState ="true"  OnSelectedIndexChanged="ddlSearchFields_SelectedIndexChanged">
    16                                       </asp:DropDownList><br />
    17                                           <asp:Panel ID="ddlPanel" runat="server" Visible="False" Width="125px" Direction="LeftToRight">
    18                                               <asp:DropDownList ID="ddlCriteria" runat="server" Font-Size="XX-Small" EnableViewState ="true" 
    19                                                   Width="155px">
    20                                               </asp:DropDownList></asp:Panel>
    21                                           <asp:Panel ID="txtPanel" runat="server" Width="125px">
    22                                       <asp:TextBox ID="txtSearchStr" runat="server" style="font :verdana; font-size :xx-small; width:155px;" EnableViewState ="true" ></asp:TextBox><cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="txtSearchStr" WatermarkText="Enter Search Criteria">
    23                                           </cc1:TextBoxWatermarkExtender>
    24                                           </asp:Panel>
    25                                       </td>
    26                                   <td style="width: 100px; height: 40px; vertical-align :middle; padding-right: 3px; padding-left: 3px;" >
    27                                       
    28                                       <asp:ImageButton ID="btnQuickSearch" runat="server" ImageUrl="~/Images/QuickSearch.jpg" OnClick="btnQuickSearch_Click" /></td></tr> </table>
    29                           <cc1:roundedcornersextender id="RoundedCornersExtender1" runat="server" targetcontrolid="tblSearch" Radius="2" Corners="All" Enabled="true" Color="222, 234, 249" ></cc1:roundedcornersextender>
    30                           </asp:Panel>                         
    31                           </ContentTemplate>
    32                            </atlas:UpdatePanel>
    

     

    And in my code behind:

    1    Protected Sub RecordSelectList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    2    
    3            Dim SearchFieldsSet As New Data.DataSet
    4            Dim SearchFieldsAdapter As New Data.SqlClient.SqlDataAdapter("SELECT FieldName, FieldValue FROM tblSearchFields WHERE RecordTypeID = @RecordTypeID ORDER BY FieldName", [Data Source])
    5            Dim Param1 As New Data.SqlClient.SqlParameter
    6            
    7            Param1 = SearchFieldsAdapter.SelectCommand.Parameters.Add("@RecordTypeID", Data.SqlDbType.NVarChar)
    8            Param1.SqlValue = Me.RecordSelectList.SelectedValue
    9            
    10           SearchFieldsAdapter.Fill(SearchFieldsSet)
    11   
    12           Me.ddlSearchFields.DataSource = SearchFieldsSet.Tables(0)
    13           Me.ddlSearchFields.DataTextField = SearchFieldsSet.Tables(0).Columns("FieldName").ColumnName.ToString()
    14           Me.ddlSearchFields.DataValueField = SearchFieldsSet.Tables(0).Columns("FieldValue").ColumnName.ToString()
    15           Me.ddlSearchFields.DataBind()
    16               
    17           SearchFieldsSet.Clear()
    18           SearchFieldsAdapter.Dispose()
    19           
    20       End Sub
    
      
     
    1    Protected Sub ddlSearchFields_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    2               
    3                Dim ds As Data.DataSet
    4                Dim tbl() As String = Split(Trim(Me.ddlSearchFields.SelectedValue), ".")
    5                
    6                ReDim param(0)
    7                ReDim paramtype(0)
    8                ReDim paramval(0)
    9                
    10               param(0) = "@TableName"
    11               paramtype(0) = 16 '"dbtype.string"
    12               paramval(0) = tbl(1)
    13               
    14               ds = bind.GetDataSet("PopulateDDLs", param, paramtype, paramval)
    15               
    16               Me.ddlCriteria.DataSource = ds.Tables(0)
    17               Me.ddlCriteria.DataTextField = ds.Tables(0).Columns(tbl(1)).ColumnName.ToString()
    18               Me.ddlCriteria.DataValueField = ds.Tables(0).Columns(tbl(1) & "ID").ColumnName.ToString()
    19               
    20               Me.ddlCriteria.DataBind()
    21               
    22               ds.Clear()
    23               ds.Dispose()
    24               
    25               Me.ddlPanel.Visible = True
    26               Me.txtPanel.Visible = False
    27           
    28       End Sub
    
      
     
     I hope that helps. Thank you in advance!
     
Page 1 of 1 (3 items)