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

Need javascript validation for radComboBox

4 Answers 134 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Shrawan
Top achievements
Rank 1
Shrawan asked on 21 Apr 2008, 12:46 PM
Hi its Shrawan from Hyd,India, 

    I have been using these Ajaxified ASP.net Rad Contrils since last one year, These days we came across the situation of using radGrid, Ajaxmanager,Ajax panel, rad Upload, tabstrip,TRee view etc etc But this is the first time we are using radCombo, the criteris to use this is A combobox with AllowCustomText property true Every thing is working fineon server side, but i am not able to fire validation with javascript, when i tries to catch id threw
 <%=RadComboBox3.ClientID %>.SelectedIndex

its giving some code error saying The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).  so Can any body help me in this issue

Thanking you alot

-Sravan Kumar Tatikonda

4 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 21 Apr 2008, 03:10 PM
Hello Shrawan,

You need to move the javascript code block outside of the head tag.

More details are available here: The Controls collection cannot be modified because the control contains code


Regards,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JustinWong
Top achievements
Rank 1
answered on 15 Dec 2008, 05:18 PM
Hi:

I'm getting the same error, and ALL my scripts are inside the body tag.  Plus, I'm not referencing any Rad Controls. Instead, I have the following:

 

<telerik:RadComboBox ID="RcbL01"
Skin="WebBlue"

 

 

 

Width="400px"
Height="250px"
Font-Size="8pt"
DropDownWidth="520px"
AppendDataBoundItems="true"

AllowCustomText="false"
OnItemDataBound="RcbL01_ItemDataBound"
OnItemsRequested="RcbL01_ItemsRequested"
OnClientSelectedIndexChanged="toggle_LnkBtnDeleteL01"
ItemRequestTimeout="500"
runat="server">

. . .

 

 (inside the script block)

 

 

function toggle_LnkBtnDeleteL01(sender, args)

{

 

    var LnkBtnDelete = document.getElementById("<%=LnkBtnDeleteL01.ClientID %>")  //------- THIS IS THE LINE THAT CREATES THE ERROR.

 

    var item = args.get_item();

 

    var N_RS02_Items = item.get_attributes().getAttribute("N_RS02_Items")

 

    if (N_RS02_Items != 0) 
    {

        LnkBtnDelete.disabled =

false;

 

    }

else {

 

        LnkBtnDelete.disabled =

true;

 

    }

 

}

 


LnkBtnDeleteL01 is simply an asp link button.

 

 

 

0
andy
Top achievements
Rank 1
answered on 15 Dec 2008, 05:59 PM

Hi Justin,

u may want to try RadCodeBlock.

 

 

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
<script language="javascript" type="text/javascript">  
 
function TestComboBox {  
var combobox = $find("<%=RadCombobox3.ClientID %>");  
}  
 
</script> 
</telerik:RadCodeBlock> 

 

 

 

0
JustinWong
Top achievements
Rank 1
answered on 15 Dec 2008, 06:04 PM

Thanks Andy. That worked!

 

Justin

Tags
ComboBox
Asked by
Shrawan
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
JustinWong
Top achievements
Rank 1
andy
Top achievements
Rank 1
Share this question
or