Solved

Cannot trigger update panel from event from cascadingdropdowns

Posted on 2009-07-02
3
582 Views
Last Modified: 2012-05-07
I have a series of cascadingdropdowns. The last dropdpwn has a an autopostback, so that when it's index changes, it can trigger an update panel update.
However when I try it, I get an error;
"Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/>

I should add that if I set EnableEventValidation="false" for the page, I do not get an exception, but also nothing seems to happen either.
<fieldset style="padding:3px">
      <legend>Business Level </legend>  
        <h2>Company</h2>
        <asp:DropDownList ID="ddlCompany" width="99%" runat="server" 
            ToolTip="Company" >
        </asp:DropDownList>
        <h2>Business</h2>
        <asp:DropDownList ID="ddlBusiness" width="99%" runat="server" 
            ToolTip="Business" >
        </asp:DropDownList>
        <h2>Business Streams</h2>
        <asp:DropDownList ID="ddlBusiness_Streams" width="99%" runat="server" 
            ToolTip="Business Streams" >
        </asp:DropDownList>
        <h2>Operating Group</h2>
        <asp:DropDownList ID="ddlOperating_Groups" width="99%" runat="server"
            ToolTip="Operating Group">
        </asp:DropDownList>
        <h2>Business Unit</h2>
        <asp:DropDownList ID="ddlBusiness_Units"  width="99%" runat="server" 
            ToolTip="Business Unit">
        </asp:DropDownList>
        <h2>Division</h2>
        <asp:DropDownList ID="ddlDivisions"  width="99%" runat="server" 
            ToolTip="Division">
        </asp:DropDownList> 
        <ajaxToolkit:CascadingDropDown ID="CascadingDropDown1" runat="server"
        TargetControlID="ddlCompany" Category="Company" PromptText="Select a company" 
        ServicePath="../WebServicesBusinessLevels.asmx" ServiceMethod="GetCompanyLevels" />
        <ajaxToolkit:CascadingDropDown ID="CascadingDropDown2" runat="server"
        TargetControlID="ddlBusiness" Category="Business" PromptText="Select a business" 
        ParentControlID="ddlCompany"
        ServicePath="../WebServicesBusinessLevels.asmx" ServiceMethod="GetBusinessLevels" />
        <ajaxToolkit:CascadingDropDown ID="CascadingDropDown3" runat="server"
        TargetControlID="ddlBusiness_Streams" Category="BusinessStream" PromptText="Select a business stream" 
        ParentControlID="ddlBusiness"
        ServicePath="../WebServicesBusinessLevels.asmx" ServiceMethod="GetBusinessStreamLevels" />
        <ajaxToolkit:CascadingDropDown ID="CascadingDropDown4" runat="server"
        TargetControlID="ddlOperating_Groups" Category="OperatingGroup" PromptText="Select an operating group" 
        ParentControlID="ddlBusiness_Streams"
        ServicePath="../WebServicesBusinessLevels.asmx" ServiceMethod="GetOperatingGroupLevels" />
        <ajaxToolkit:CascadingDropDown ID="CascadingDropDown5" runat="server"
        TargetControlID="ddlBusiness_Units" Category="BusinessUnit" PromptText="Select a business unit" 
        ParentControlID="ddlOperating_Groups"
        ServicePath="../WebServicesBusinessLevels.asmx" ServiceMethod="GetBusinessUnitLevels" />
        <ajaxToolkit:CascadingDropDown ID="CascadingDropDown6" runat="server"
        TargetControlID="ddlDivisions" Category="Division" PromptText="Select a devision" 
        ParentControlID="ddlBusiness_Units"
        ServicePath="../WebServicesBusinessLevels.asmx" ServiceMethod="GetDivisionLevels" />
      </fieldset> 
  <div id="maincenter">
    <asp:UpdatePanel runat="server" ID="updProjects" UpdateMode="Conditional">
        <ContentTemplate>
       <cc1:InsertableGrid ID="gvwProjects" runat="server" AllowPaging="True" AutoGenerateColumns="False"
        DataSourceID="odsProjects"  DataKeyNames="Div_No,Project"
          AllowInsert="True"
           onRowCreated="gvwProjects_RowCreated" 
           OnRowInserting="gvwProjects_RowInserting"
           OnRowInserted="gvwProjects_RowInserted"
           OnRowUpdated="gvwProjects_RowUpdated">
          <Columns>
              <asp:CommandField ShowEditButton="True" ShowDeleteButton="True" />
              <asp:BoundField DataField="Project" HeaderText="Project" SortExpression="Project" />
              <asp:BoundField DataField="Name_Long" HeaderText="Name Long" SortExpression="Name_Long" />
              <asp:BoundField DataField="Name_Short" HeaderText="Name Short" SortExpression="Name_Short" />
              <asp:BoundField DataField="PM_NetworkID" HeaderText="PM NetworkId" SortExpression="PM_NetworkID" />
          </Columns>
      </cc1:InsertableGrid>
   
      <asp:ObjectDataSource ID="odsProjects" runat="server" 
          SelectMethod="GetProjects_Manual"
          TypeName="Biz.Projects"
          DeleteMethod="Delete_Project"
          InsertMethod="Insert_Project"
          UpdateMethod="Update_Project">
          <SelectParameters>
              <asp:ControlParameter ControlID="ddlDivisions" Name="_Div_No" PropertyName="SelectedValue"
                  Type="Int32" />
          </SelectParameters>
          <DeleteParameters>
              <asp:ControlParameter ControlID="ddlDivisions" Name="Div_No" PropertyName="SelectedValue"
                  Type="Int32" />
              <asp:Parameter Name="Project" Type="string" />
          </DeleteParameters>
          <UpdateParameters>
              <asp:ControlParameter ControlID="ddlDivisions" Name="Div_No" PropertyName="SelectedValue"
                  Type="Int32" />
              <asp:Parameter Name="Project" Type="string" />
              <asp:Parameter Name="Name_Long" Type="string" />
              <asp:Parameter Name="Name_Short" Type="string" />
              <asp:Parameter Name="PM_NetworkID" Type="string" />
          </UpdateParameters>
          <InsertParameters>
              <asp:ControlParameter ControlID="ddlDivisions" Name="Div_No" PropertyName="SelectedValue"
                  Type="Int32" />
              <asp:Parameter Name="Project" Type="string" />
              <asp:Parameter Name="Name_Long" Type="string" />
              <asp:Parameter Name="Name_Short" Type="string" />
              <asp:Parameter Name="PM_NetworkID" Type="string" /> 
          </InsertParameters>
      </asp:ObjectDataSource>
      &nbsp;
        <asp:Label ID="lblMessage" runat="server" ForeColor="Red" ></asp:Label>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ddlDivisions" EventName="selectedindexchanged" />
        </Triggers>
    </asp:UpdatePanel>
  </div>

Open in new window

0
Comment
Question by:hijiki7777
  • 2
3 Comments
 

Author Comment

by:hijiki7777
ID: 24764467
Well I found a solution.
I just have to put an event in the dropdown. I decided to make the grid invisible, then in the event make it visible, then it works (see code below).
However I would still like to know why this makes a difference. It seems odd that I have to put this extra bit of code in.

<asp:DropDownList ID="ddlDivisions"  width="99%" runat="server" 
            OnSelectedIndexChanged="ddlDivisions_OnSelectedIndexChanged"
            ToolTip="Division" AutoPostBack="true">
        </asp:DropDownList>

Open in new window

0
 
LVL 41

Expert Comment

by:guru_sami
ID: 24764903
just wondering in your initial code you had"
 <asp:DropDownList ID="ddlDivisions"  width="99%" runat="server"
            ToolTip="Division">
For postback to occur when selection changes in ddlDivisions you need AutoPostBack="true" and thats what you added in your working code.
Hope I understood the problem correctly.
0
 

Accepted Solution

by:
hijiki7777 earned 0 total points
ID: 24770820
That is what I thought and why I find it confusing.
That is the only difference.
I put in an event handler not expecting it to make any difference, but it did.
Autopostback alone should have worked.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reset asp.net login password 4 42
ASP.NET MVC 2 31
https://github.com/willowsystems/jSignature 11 46
Reading the web config for a running service on Windows 10 16 39
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now