Results 1 to 28 of 28

Thread: Problem in dropdown inside updatepanel

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Problem in dropdown inside updatepanel

    Hi,

    I am using Asp.Net 3.5. I am having two problems in dropdown inside the update panel. I have two drop down list. First dropdown i loaded the data from db. Its working fine. Once i changed the data using SelectedIndexChange event it's firing first time(i put AutoPostback="true") if i click multiple times for multiple data it's not fired. If changed the value i bind the data to another dropdown list. But it is not binding. My control is inside the update panel. What is the problem? i came across multiple site and try it.But no use? Its very urgent. I put the code here.

    //////////// HTML Source Code/////////////////////////
    Code:
    <form id="MAppNHSTDAfrm" runat="server">
        <telerik:RadScriptManager ID="RdScptMgrMAppNHSTDAfrm" EnablePartialRendering="true"
            AsyncPostBackTimeout="36000" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadStyleSheetManager ID="RdStyMgrMAppNHSTDAfrm" EnableStyleSheetCombine="true"
            runat="server">
        </telerik:RadStyleSheetManager>
        <div class="contentcontainer">
            <fieldset style="width: 98&#37;; height: 93%">
                <asp:UpdatePanel ID="uPnlProgramDetails" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <table border="0" cellpadding="3" cellspacing="2" style="width: 100%;">
                            <tr>
                               <td id="Td7" runat="server">
                                                    Branch :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   
                                                   <asp:DropDownList ID="uxBranch" runat="server"  AutoPostBack = "true"
                                                        onselectedindexchanged="uxBranch_SelectedIndexChanged">
                                                   </asp:DropDownList>
                                                </td>
                                                
                                                <td id="Td8" runat="server" class="datafield">
                                                Trust :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                
                                                <asp:DropDownList ID="uxTrust" runat="server">
                                                </asp:DropDownList>
                                                </td>
    </tr>
    </table>
      </ContentTemplate>
                    <%--<Triggers>
                  <%--<asp:AsyncPostBackTrigger ControlID="TypeOfApplicationDropDown" /> --%>
                  <asp:AsyncPostBackTrigger ControlID="uxBranch" EventName="SelectedIndexChanged" />
                </Triggers>--%>
                </asp:UpdatePanel>
            </fieldset>
        </div>
        </form>
    ///////Code behind///////////////////
    Code:
    protected override void Page_Load(object sender, EventArgs e)
            {
               if (!Page.IsPostBack)
                {
                        FillDropDown();
                }
            }
      protected void FillDropDown()
            {
                FillForBranch();
             }
    //Fill data for first drop down when page load
    
               protected void FillForBranch()
            {
                try
                {
                    ResultBE result;
                    DataTable lookUpTable = new DataTable();
                    lookUpReference = new LovValueBLL();
                    lookUpTable = lookUpReference.GetLovValue(27, "%", out result);
                    uxBranch.DataTextField = "ValueDesc";
                    uxBranch.DataValueField = "ID";
                    uxBranch.DataSource = lookUpTable;
                    uxBranch.DataBind();
                    AddSelect(uxBranch);
                    //uxBranch.SelectedIndex = 0;
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }
            }
    
    // select changed the value from the first dropdown and load in other drop down
    protected void uxBranch_SelectedIndexChanged(object sender, EventArgs e)
                {
                    if (uxBranch.SelectedValue == "1738")
                    {
                        FillForBranchAdult();
                     }
                    if (uxBranch.SelectedValue == "1739")
                    {
                        FillForBranchChild();
                    }
                    if (uxBranch.SelectedValue == "1740")
                    {
                        FillForBranchMentalHealth();
                    }
                }
    
      protected void FillForBranchAdult()
            {
                try
                {
                    ResultBE result;
                    DataTable lookUpTable = new DataTable();
                    lookUpReference = new LovValueBLL();
                    lookUpTable = lookUpReference.GetLovValue(24, "%", out result);
                    uxTrust.DataTextField = "ValueDesc";
                    uxTrust.DataValueField = "ID";
                    uxTrust.DataSource = lookUpTable;
                    uxTrust.DataBind();
                    //uPnlProgramDetails.Update();
                    AddSelect(uxTrust);
                    
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }
            }
    Hope your's reply.

    Thanks
    Last edited by Guvera; Sep 15th, 2010 at 04:52 AM.
    Failing to plan is Planning to fail

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Problem in dropdown inside updatepanel

    Guvera, when you are posting code into the forums, can you remember to surround it in [CODE][/CODE] tags, it makes it SO much more easy to read!!

    Does your code work if you do not include the UpdatePanel?

    Gary

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: Problem in dropdown inside updatepanel

    Hi gep,

    my code is working fine without update panel. But i want to without refreshing the whole page and need to do this. So i put updatepanel

    Thanks
    Failing to plan is Planning to fail

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Problem in dropdown inside updatepanel

    Okay, so it is obvious that something with the UpdatePanel is incorrect then.

    Can you go back and edit your first post to include CODE tags, or if you can't do that, can you post the code again, at least that way, it won't have smilies in it , and I will take a look.

    Also, are there any errors on the page, either .Net or JavaScript? Bear in mind you may have to enable your browser to show you JavaScript errors. If so, what are they?

    Gary

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: Problem in dropdown inside updatepanel

    hi gep,

    Thanks for your reply. I edit my first post in code tag. I would like to tell that no javascript errors here. It's all depends upon the update panel. What is incorrect in my code? Please suggest me.
    Hope your's reply
    Thanks
    Failing to plan is Planning to fail

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: Problem in dropdown inside updatepanel

    Hi gep,

    i am sorry dude. now i enabled javascript in my browser. when i selectindexchanged at many times i got an exception in script

    "Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: The state information is invalid for this page and might be corrupted."

    this is happening. but first time i select index changed data in the drop down its fired. But it is not fired i did another data in the dropdown. I got an above error. Also first time it is fired ok but it is not binding in another drop down. what is the problem?

    Hope your's reply

    Thanks
    Failing to plan is Planning to fail

  7. #7
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Problem in dropdown inside updatepanel

    hay,
    what about the Script Manager in your page?

    is it the .net script manager or ajax toolkit script manager
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  8. #8
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Problem in dropdown inside updatepanel

    hay,
    what about the Script Manager in your page?

    is it the .net script manager or ajax toolkit script manager
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  9. #9
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Problem in dropdown inside updatepanel

    Ah, I think avrail might be onto something here.

    What steps did you take to enable AJAX on this page?

    Gary

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: Problem in dropdown inside updatepanel

    Quote Originally Posted by avrail View Post
    hay,
    what about the Script Manager in your page?

    is it the .net script manager or ajax toolkit script manager
    Code:
     <telerik:RadScriptManager ID="RdScptMgrMAppNHSTDAfrm" EnablePartialRendering="true"
            AsyncPostBackTimeout="36000" runat="server">
        </telerik:RadScriptManager>
    Failing to plan is Planning to fail

  11. #11
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Problem in dropdown inside updatepanel

    Now, I am not a user of the Telerik Controls, but does that ScriptManager wrap the AJAX one? Or is it solely for the use of the Telerik Controls?

    Gary

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: Problem in dropdown inside updatepanel

    Quote Originally Posted by gep13 View Post
    Now, I am not a user of the Telerik Controls, but does that ScriptManager wrap the AJAX one? Or is it solely for the use of the Telerik Controls?

    Gary
    Hi gep,

    I am using asp.net drop down control with telerik script manager. I added the code,

    Code:
     ScriptManager.GetCurrent(this).RegisterPostBackControl(TrustAllocationBranch);
    the above code refresh and multiple times select index changed problem is solved. But at the time of postback my tabcontrol is gone. What is the problem? Hope your reply
    Failing to plan is Planning to fail

  13. #13
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Problem in dropdown inside updatepanel

    hay,
    i was going to ask you about
    Code:
    AsyncPostBackTimeout="36000"
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  14. #14
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Problem in dropdown inside updatepanel

    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: Problem in dropdown inside updatepanel

    Quote Originally Posted by avrail View Post
    HI,

    I put the default seconds as what you gave in the link. But it is not working.

    If i am using Triggers in update panel and autopostback = "false" also not

    working.

    Thanks
    Failing to plan is Planning to fail

  16. #16
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Problem in dropdown inside updatepanel

    ok,
    is there is any chance to change
    Code:
    telerik:RadScriptManager
    to .net ScriptManager
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  17. #17

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Re: Problem in dropdown inside updatepanel

    No avraill, we are using this third party tool. so no chance. But i am using another module in the same work that is select dropdown multiple times and bind data to another drop down. It is working fine. On the same way i am doing in this module. But it is not firing. I am confused. Why it is happening? Hope yours reply.
    Thanks
    Failing to plan is Planning to fail

  18. #18
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Problem in dropdown inside updatepanel

    ok,
    there is something when i be in such a case like yours,
    i create the same page step by step, just a simple one,
    and adding a part of the code method after the another,
    i know that's sound bad, but it works for me.
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  19. #19
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Problem in dropdown inside updatepanel

    I have to agree with Avrail here.

    Create a simple page, not including the Telerik controls at the minute, try with just a standard drop down list, and an standard update panel, within a standard script manager. See if you can get this working, the way you want it, and then start adding in your other controls.

    Gary

  20. #20
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Problem in dropdown inside updatepanel

    hay Guvera,
    do you still facing problems?
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  21. #21
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    Re: Problem in dropdown inside updatepanel

    I don't think i'm going to help here just wanted to share my opinion. I think that the UpdatePanel and the ScriptManager is really bad tools for using AJAX, at first glance it's looks really cool how easy it is to add ajax with these controls, but once you try to take your AJAX to be a bit more complicated then very basic AJAX the updatepanel start to acting up, not to mention thats it's MUCH slower then native ajax, and on top of all that, once you added the ScriptManager control to your web pages you get 3 filty JS files added to your code with the size of 400K! In my opinion UP and SM are just another "proof of concept" controls by microsoft, but don't get me wrong, I LOVE the .NET framework!

    my advice pick your favorite Javascript Library and launch your nifty AJAX magics with that, a bit more work but it worth it
    * Rate It If you Like it

    __________________________________________________________________________________________

    "Programming is like sex: one mistake and you’re providing support for a lifetime."

    Get last SQL insert ID

  22. #22
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Problem in dropdown inside updatepanel

    actually most of the problems comes from the miss-understanding of the user who work with the ajax,
    not form the AJAX.

    before you use a tool, you must understand more about its life cycle that's more important.
    that's my opinion
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  23. #23
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    Re: Problem in dropdown inside updatepanel

    Hi Avarail,

    actually i think you just didn't worked with the updatepanel enough, anyway just the fact for it adding 400K js files should be more then enough for one to drop the update panel if performance is something he care about, ant about your other comments? i decided to check myself to see if i'm wrong i made simple search "updatepanel vs ajax"

    the first link i got is from microsoft msdn magazine and for my surprise it's saying the exactly same thing i wrote in the other post.

    in other links they proving that working with ajax the native way its 4000&#37; faster, quote:
    "Using JSON, the entire HTTP round trip is 24 bytes, as compared to 872 bytes for the UpdatePanel. That’s roughly a 4,000% improvement, which will only continue to increase with the complexity of the page."

    enjoy:

    http://msdn.microsoft.com/en-us/magazine/cc163413.aspx

    http://encosia.com/2007/07/11/why-as...are-dangerous/

    or just google for:

    http://www.google.co.il/search?q=updatepanel+vs+ajax&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-USfficial&client=firefox-a
    * Rate It If you Like it

    __________________________________________________________________________________________

    "Programming is like sex: one mistake and you’re providing support for a lifetime."

    Get last SQL insert ID

  24. #24
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Problem in dropdown inside updatepanel

    amm, so moitil you want me to create all this javascript,
    no
    and AJAX is not only the UpdatePanel + these articles were July 11th, 2007 don't you think there is more was added from this date till now.
    if not then we are waiting for more improvement, and i believe that it will be

    "truth is that UpdatePanels, by design and due to their nature, pass a lot more stuff over the wire than PageMethods. Remember, they pass the changed markup, ViewState etc over the wire.

    What the article/post says about it is true. However, it is always context dependant, is it an issue. Is the Page so big that async postback with UpdatePanel is unbearable? There are also ways to optimize things like reducing the unneeded ViewState, using multiple UpdatePanels to split the page to as-small-as-possible regions which need to be updated using UpdatePanel. E.g update only the parts which really need to be updated instead of passing everything you have on the Page. Using one UpdatePanel for entire page for example is not wise, if the page can be split up.
    "
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  25. #25
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    Re: Problem in dropdown inside updatepanel

    Hi avrail.
    you don't need to write a lot of js for working without the UP, but yes working with native js instead of the UP mean more work, but that is not the reason that should stop you for getting better performance.

    2nd trust me i'm not microsoft technology hater, for someone that working a lot with ajax i'll be the first one to use the UP when it work like it should.

    now for what you quoted:
    Code:
    "truth is that UpdatePanels, by design and due to their nature, pass a lot more stuff over the wire than PageMethods. Remember, they pass the changed markup, ViewState etc over the wire.
    that's exactly my point, the reason you using ajax is for partial postback, if you didn't understand it already when you using the UP your page is been full loaded including life cycle, methods and even view state(?!?) this is breaks the all point of using ajax, so yes you can go and try optimize your code for your ajax calls to some degree but you'll never get the same clean result you'll get using native ajax.

    anyways if you feel that the UP is working for you the go for it, personally, I won't use it until MS improve it to support real partial postback and fix a lot of its problems.
    * Rate It If you Like it

    __________________________________________________________________________________________

    "Programming is like sex: one mistake and you’re providing support for a lifetime."

    Get last SQL insert ID

  26. #26
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Problem in dropdown inside updatepanel

    i didn't use updatepanel indeed motil a lot, but i think for the people who don't use a lot of JavaScript this will be good in some cases.
    let us hope Microsoft solve these problems
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  27. #27
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Problem in dropdown inside updatepanel

    i didn't use updatepanel indeed motil a lot, but i think for the people who don't use a lot of JavaScript this will be good in some cases.
    let us hope Microsoft solve these problems
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  28. #28

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Re: Problem in dropdown inside updatepanel

    Finally i didnt get any useful solutions in this post.

    Thanks
    Failing to plan is Planning to fail

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width