Ajax and combo

6 posts, 0 answers
  1. John Giblin
    John Giblin avatar
    155 posts
    Member since:
    Jan 2006

    Posted 21 Dec 2012 Link to this post

    I am having strange results with the combo box.  For some reason it is rebindig after I bind it.  
    My first issue was u was trying to remove an item from the list if it was not selected.  Since it was doing this word reminding,  I had to remove it on the ondataload method. The next problem was that the selected value was not remaining. I set the value.  I step through the code and I see it being set.  Then when the page is displayed the value is no longer set.  How can I track these behind the scenes processes. 
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 21 Dec 2012 Link to this post

    Hello John,

    From your description I don't quite understand what is going on. Would be able to post what your page markup and code looks like, so we can see where the problem is?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John Giblin
    John Giblin avatar
    155 posts
    Member since:
    Jan 2006

    Posted 21 Dec 2012 Link to this post

    I wish I could. Besides being long, I cant post it. 


    But there is a editpage opens a window that is triggered inside a radgrid (RadGrid1_ItemCommand)

     

     

     

     

     

    var currentRow = otv.Items[e.Item.ItemIndex];

     

    //set some page values

     

    otv.IsItemInserted = false;

     

    otv.EditFormSettings.UserControlName =

     

    "UserControls/frmXXX.ascx";


    The mysterious thing is I put break points in  "UserControls/frmXXX.ascx"  where I see that combo box.  I step through the code. It sets it, but at the end I see the OnDataBound hits 2x.  But I dont see howor where that is being triggered from.

    any help would be appreciated.  Sorrry for the lack of code

    John

     

  5. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 22 Dec 2012 Link to this post

    Hello John,

    The double rebind makes sense now. The reason it binds twice is once from you explicitly calling it and then again by the RadGrid which tells it child controls to bind themselves. If this UserControl is only going to be used as the EditForm for the RadGrid, I would suggest not explicitly calling the DataBind method on the RadComboBox and just leave it up to the RadGrid to call databind.

    I hope that helps.
  6. John Giblin
    John Giblin avatar
    155 posts
    Member since:
    Jan 2006

    Posted 27 Dec 2012 Link to this post

    thanks kevin. I will try that.  The one thing I also found weird is that I looked everywhere in "UserControls/frmXXX.ascx"; for the combo box and put breakpoints where it sets it. I see the ondatabound being hit 2x.  but I can only see it hit the area one time where it gets the data and sets the value.  When I run the debugger, it steps through and the value is set correctly and then it is step through the ascx page and then it unsets it.

    The 2 things I was trying to accomplish is not to get double values in the drop-down, remove a value and have the value set correctly.
     So I:
    1. removed the attribute: AppendDataBoundItems which affected the value from being set behind code, 
    2. Set the value in the ascx page to solve the above issue
    3. use the onDatabound to remove an item


    Btw I tried to post the code but I can only attach images

  7. John Giblin
    John Giblin avatar
    155 posts
    Member since:
    Jan 2006

    Posted 11 Jan 2013 Link to this post

    Is there any way of know when you use an item template within the grid.  

    I usually us Page.IsPostBack to tell whether to set up the form fields.  but in this case it comes up true 

    thanks in advance
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017