I have an asp:DropDownList inside an asp:FormView.
When the user selects the specific value of the ddl, the panel (incorporating a text box) is shown, otherwise the panel is hidden.
This all works as it should.
However, when I attempt to replace the asp:DropDownList with a
telerik.RadComboBox, the javascript fails to fire.
Any suggestions?
Here is my code:
CS
protected void FormViewSkillDetails_DataBound(object sender, EventArgs e)
{
//START: HIDE / SHOW THE EDIT SKILL OWN HEADING DETERMINED BY THE VALUE IN THE DROP DOWN LIST.
if (FormViewSkillDetails.CurrentMode == FormViewMode.Edit)
{
FormViewSkillDetails.Focus(); //place the cursor on the 1st available field of the form view.
//DropDownList ddl = (DropDownList)FormViewSkillDetails.FindControl("DropDownListSkillTypeEditDisplay"); //THIS IS THE WORKING ASP/JAVASCRIPT CODE.
RadComboBox ddl = (RadComboBox)FormViewSkillDetails.FindControl("RadComboBox1"); //THIS IS THE NON-WORKING TELERIK/JAVASCRIPT CODE.
Panel p = (Panel)FormViewSkillDetails.FindControl("PanelSkillOwnHeadingEditItem");
RequiredFieldValidator rfv = (RequiredFieldValidator)FormViewSkillDetails.FindControl("RequiredFieldValidatorClientSideSkillOwnHeadingEdit");
CustomValidator cvss = (CustomValidator)FormViewSkillDetails.FindControl("CustomValidatorServerSideSkillOwnHeadingEditItemBlank");
ddl.Attributes.Add("onchange", "JavaScript:selectInputEditChange('" + ddl.ClientID + "', '" + p.ClientID + "', '" + rfv.ClientID + "', '" + cvss.ClientID + "');");
}
//FINISH: HIDE / SHOW THE EDIT SKILL OWN HEADING DETERMINED BY THE VALUE IN THE DROP DOWN LIST.
}
JAVASCRIPT
<script type="text/javascript">
function selectInputEditChange(ddl_id, pan_id, rfv_id, cvss_id) {
var ddl = document.getElementById(ddl_id);
var pan = document.getElementById(pan_id);
var rfv = document.getElementById(rfv_id);
var cvss = document.getElementById(cvss_id);
if (ddl.value == "817") {
pan.style.display = 'inline';
ddl.focus();
rfv.enabled = true;
cvss.enabled = true;
}
else {
pan.style.display = 'none';
ddl.focus();
rfv.enabled = false;
cvss.enabled = false;
}
}
</script>
HTML / ASP / TELERIK
(This code resides inside a form view edit item template - FormViewSkillDetails)
Member
15 Points
95 Posts
JavaScript not working with RadComboBox (but works with asp DDL)
Jul 29, 2009 07:54 PM|FattMatt|LINK
I have an asp:DropDownList inside an asp:FormView.
When the user selects the specific value of the ddl, the panel (incorporating a text box) is shown, otherwise the panel is hidden.
This all works as it should.
However, when I attempt to replace the asp:DropDownList with a telerik.RadComboBox, the javascript fails to fire.
Any suggestions?
Here is my code:
CS
JAVASCRIPT
HTML / ASP / TELERIK
(This code resides inside a form view edit item template - FormViewSkillDetails)
Member
150 Points
62 Posts
Re: JavaScript not working with RadComboBox (but works with asp DDL)
Jul 30, 2009 12:37 AM|masterpass|LINK
can you try this ...
When you are using the RadComboBox
Replace
var ddl = document.getElementById();
as
var ddl = <%= RadComboBox1.ClientID %>;(try using this as it is, don't add single quote to the server refrence)
Please mark ANSWER to the post which helped you ...
Member
15 Points
95 Posts
Re: JavaScript not working with RadComboBox (but works with asp DDL)
Jul 30, 2009 06:05 PM|FattMatt|LINK
Thanks masterpass, but that replacement of code didn't work.
This has me stumped.
Any other suggestions?
None
0 Points
3 Posts
Re: JavaScript not working with RadComboBox (but works with asp DDL)
Mar 12, 2010 01:59 AM|dttrung|LINK
The event "onchange" is not a member event of RadCombobox in javascript or in Client event.
I'm error too.
I'm trying:
ddl.Attributes.Add("onchange", "JavaScript:alert('lmn');")
But it's not work.
who can help.
Member
40 Points
43 Posts
Re: JavaScript not working with RadComboBox (but works with asp DDL)
Mar 12, 2010 02:07 AM|suresh K|LINK
hi
can you refere these links to do actions in Client Side(Java Script)
http://demos.telerik.com/aspnet-ajax/combobox/examples/programming/clientevents/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/combo_clientsidebasics.html
http://www.telerik.com/help/aspnet-ajax/combo_clientsideonclientselectedindexchanged.html