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

[Solved] Dropdown event registering issue when loading partial view at runtime

1 Answer 99 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rakesh
Top achievements
Rank 1
Rakesh asked on 02 Mar 2012, 09:47 PM
Hi

I have a situation where in i need to add more than 1 email address when user click on + link.
In order to archive this i created a partial view with 'email type' dropdown and textbox for 'email address'. when i click on + link ajax call goes to my action which get the emailtype datasource into viewbad and return the partial view.

Partial view added into a div but when i try to select the dropdown it is not listing the value. It look like a disabled on, but it shows first value in the dropdown. Only issue is i cant able to select value from newly loaded partial view dropdown.

Following is my code snippets

PartialView
@using Telerik.Web.Mvc.UI
<div>
        @(Html.Telerik().DropDownList().Name("ddnEmailType")
.BindTo(new SelectList(ViewBag.EmailType, "ReferenceId", "ReferenceName"))
                                               .HtmlAttributes(new { style = string.Format("width:{0}px", 80) }))
        @Html.TextBox("txtEmail")
</div>

Controller that returns partial view
public ActionResult AddEmail()
        {
            ViewBag.EmailType =  // Logic to get email type from database eg: home, office are 2 type from database.
            return PartialView("_AddEmailPartial");
        }

View which gets user's information(this has + link to get more than 1 type of email address)
/// this is the ajax link that used to add more than 1 email type.
 
@Ajax.ActionLink(" ", "AddEmail", null, new AjaxOptions
{ InsertionMode = InsertionMode.InsertAfter, UpdateTargetId = "addemailaddress" }, new { @class = "AddIcon" })
 
 
<div id="addemailaddress" class="phoneMailSectionAdd">
/// this is the div used to add the partial view.
</div>
Runtime Observation: 1 diff that i found on the control that rendered on the browser is, The control in view page has some jquery###### no =## but the one added by partial view does not have it.
Please reply me as soon as possible.

1 Answer, 1 is accepted

Sort by
0
tbellinger
Top achievements
Rank 1
answered on 17 Jul 2012, 08:31 PM
+1 

I have the exact same issue.  I am adding a partial view containg a radcombobox several times to a page through a PartialViewResult.  The first instance of each item appears and works fine, but each subsequent one fails.  I suspect it is also the name/id + event wireup that is only happening to the first instance of each control on the page.

Any solutions?
Tags
ComboBox
Asked by
Rakesh
Top achievements
Rank 1
Answers by
tbellinger
Top achievements
Rank 1
Share this question
or