Attribute value is not persisting

4 posts, 0 answers
  1. Anirban
    Anirban avatar
    7 posts
    Member since:
    May 2011

    Posted 04 Aug 2011 Link to this post

    I am using RadCombobox in a grid. I have assigned attribute to the rad combobox from Javascript method. The code is below

     var masterTable = $find("<%=radgrdChargeType.ClientID%>").get_masterTableView();
             
             var dataRow = masterTable.get_dataItems()[popupTextControlId];
              var radCmbBxChargeType = dataRow.findControl("radCmbBxChargeType");
     radCmbBxChargeType.trackChanges();
              radCmbBxChargeType.get_attributes().setAttribute("Ani", "Vai");
              radCmbBxChargeType.get_attributes().setAttribute("1", "2");
              radCmbBxChargeType.commitChanges();



    Now I am trying to get the attribute value from Code behind page.

     RadComboBox radCmbBxChargeType = gridItem.FindControl("radCmbBxChargeType") as RadComboBox;
                if (radCmbBxChargeType.Attributes["Ani"] != null)
                {
                    string att = radCmbBxChargeType.Attributes["Ani"];
                }


    But here the data is not persisting, i.e. 
    radCmbBxChargeType.Attributes["Ani"]  is showing null.


    How I can get the value !!
    Note. - getting the exact combobox is not a problem.

    It's urgent 
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 08 Aug 2011 Link to this post

    Hi Anirban,

    In general the custom attributes are supported by the RadComboBox's items not by the control itself. This is why a custom attributes assigned to the RadComboBox are not persisted upon post-back.
    Please refer to the following help article discussing this functionality.

    Greetings,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Anirban
    Anirban avatar
    7 posts
    Member since:
    May 2011

    Posted 10 Aug 2011 Link to this post

    Hi Terziev,

    Thanks a lot for giving me the reply.
    But in case of Radcombobox we have Attributes which we can use at code behind page.

    Ex. -

    RadComboBox 

    radCmbBxMeterDataType = 
            e.Item.FindControl(
    "radCmbBxMeterDataType") as RadComboBox;

    string name = 
            radCmbBxMeterDataType.Attributes["

    FirstName"];

    We can go in that way.Am I right !
    But if we assign the attribute to the combobox from javascript and try to access that from Code behind page, it
    is giving me the error.


    Regards,
    Anirban

     

  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 15 Aug 2011 Link to this post

    Hi Anirban,

    Please, use trackChanges() and commitChanges() as shown in this help topic -
    http://www.telerik.com/help/aspnet-ajax/combobox-client-side-radcombobox.html


    Kind regards,
    Peter
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top