This is a migrated thread and some comments may be shown as answers.

Attribute value is not persisting

3 Answers 164 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Anirban
Top achievements
Rank 1
Anirban asked on 04 Aug 2011, 07:57 AM
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 

3 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 08 Aug 2011, 04:21 PM
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.

0
Anirban
Top achievements
Rank 1
answered on 10 Aug 2011, 02:37 PM
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

 

0
Peter
Telerik team
answered on 15 Aug 2011, 07:08 AM
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.

Tags
ComboBox
Asked by
Anirban
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Anirban
Top achievements
Rank 1
Peter
Telerik team
Share this question
or