This is a migrated thread and some comments may be shown as answers.
Dropdown list "onchange" help
1 Answer 120 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
vina
Top achievements
Rank 1
vina asked on 11 Nov 2010, 09:50 AM
Hi,

I have a "submit" button in a form that display a record .

I have a drop down list on that same form, I want it to
perform the same submit action as above once a value is chosen.

Please tell me what changes i need to do for this.

Thanx

Vina.

1 Answer, 1 is accepted

Sort by
0
al
Top achievements
Rank 1
answered on 25 Nov 2010, 12:21 AM
Submit the form once the item is selected in the dropdownlist with the onchange event
<%=Html.Telerik().DropDownList()
    .Name("dropdownname")
    .ClientEvents(events => events
    .OnChange("submitform()" )
    )
    .HtmlAttributes(new {id="dropdownid" })%>

<script type="text/javascript">
    function onDropDownListChange<%=Model.CategoryID%>(e) {
        familyList.getBodyStyles('<%=Model.DealerCode%>', '<%=Model.CategoryID%>', e.value, '<%=Url.Action("BodyStyles", "Home") %>')
    }

</script>
<script type="text/javascript">
    function onDropDownListChange<%=Model.CategoryID%>(e) {
        familyList.getBodyStyles('<%=Model.DealerCode%>', '<%=Model.CategoryID%>', e.value, '<%=Url.Action("BodyStyles", "Home") %>')
    }

</script>
<script type="text/javascript">
    function submitform() {
        ///
    }
 
</script>


            <%=Html.Telerik().DropDownList()
                .Name("FamilyCode")
                .ClientEvents(events => events
                .OnChange("onDropDownListChange"+ Model.CategoryID )
                )
                .BindTo(Model.Classes)
                .HtmlAttributes(new { style = "width:253px;height:22px;font-family:Arial,Verdana,Helvetica;font-size:12px;",id="ddlFamilyCode"+Model.CategoryID })%>

 <%=Html.Telerik().DropDownList()
                .Name("FamilyCode")
                .ClientEvents(events => events
                .OnChange("onDropDownListChange"+ Model.CategoryID )
                )
  
            <%=Html.Telerik().DropDownList()
                .Name("FamilyCode")
                .ClientEvents(events => events
                .OnChange("onDropDownListChange"+ Model.CategoryID )
                )
                .BindTo(Model.Classes)
                .HtmlAttributes(new { style = "width:253px;height:22px;font-family:Arial,Verdana,Helvetica;font-size:12px;",id="ddlFamilyCode"+Model.CategoryID })%>
             .BindTo(Model.Classes)
                .HtmlAttributes(new { style = "width:253px;height:22px;font-family:Arial,Verdana,Helvetica;font-size:12px;",id="ddlFamilyCode"+Model.CategoryID })%>
 <%=Html.Telerik().DropDownList()
                .Name("FamilyCode")
                .ClientEvents(events => events
                .OnChange("onDropDownListChange"+ Model.CategoryID )
  
<%=Html.Telerik().DropDownList()
    .Name("FamilyCode")
    .ClientEvents(events => events
    .OnChange("onDropDownListChange"+ Model.CategoryID )
    )
    .BindTo(Model.Classes)
    .HtmlAttributes(new { style = "width:253px;height:22px;font-family:Arial,Verdana,Helvetica;font-size:12px;",id="ddlFamilyCode"+Model.CategoryID })%>
             )
                .BindTo(Model.Classes)
                .HtmlAttributes(new { style = "width:253px;height:22px;font-family:Arial,Verdana,Helvetica;font-size:12px;",id="ddlFamilyCode"+Model.CategoryID })%>
 <%=Html.Telerik().DropDownList()
                .Name("FamilyCode")
                .ClientEvents(events => events
                .OnChange("onDropDownListChange"+ Model.CategoryID )
                )
                .BindTo(Model.Classes)
                .HtmlAttributes(new { style = "width:253px;height:22px;font-family:Arial,Verdana,Helvetica;font-size:12px;",id="ddlFamilyCode"+Model.CategoryID })%>
            <%=Html.Telerik().DropDownList()
                .Name("FamilyCode")
                .ClientEvents(events => events
                .OnChange("onDropDownListChange"+ Model.CategoryID )
                )
  
<%=Html.Telerik().DropDownList()
    .Name("FamilyCode")
    .ClientEvents(events => events
    .OnChange("onDropDownListChange"+ Model.CategoryID )
    )
    .BindTo(Model.Classes)
    .HtmlAttributes(new { style = "width:253px;height:22px;font-family:Arial,Verdana,Helvetica;font-size:12px;",id="ddlFamilyCode"+Model.CategoryID })%>
             .BindTo(Model.Classes)
                .HtmlAttributes(new { style = "width:253px;height:22px;font-family:Arial,Verdana,Helvetica;font-size:12px;",id="ddlFamilyCode"+Model.CategoryID })%>
Tags
ComboBox
Asked by
vina
Top achievements
Rank 1
Answers by
al
Top achievements
Rank 1
Share this question
or