This question is locked. New answers and comments are not allowed.
In my project there is scenario like I have a TabStrip on one aspx page, for each tab of TabStrip I load User Control (ascx) which has a Telerik Grid on it to which data bound by Ajax technique. For grid I used PopUp Edit mode. I have used Client Edit Template for one grid which shows a DropDownList to which IndustryID and Industry pair is bound. My problem is that when I click on Add Record or edit record Data get selected perfectly (in case of edit) to the DropDownList on popup. but when I click on Save or Update I am unable to get the selected value at Controller. I am listing code snippets below...
Model :(EditableShow.cs)
[KnownType(typeof(EditableShow))]
public class EditableShow
{
[ScaffoldColumn(false)]
public int ShowID{get; set; }
[Required(ErrorMessage = "*")]
[DisplayName("Show")]
public string Show{get; set;}
[UIHint("ShowIndustry"), Required(ErrorMessage = "*")]
public int IndustryID{get; set;}
public string Industry{get; set;}
}
Grid on ascx :(ShowGrid.ascx)
<%= Html.Telerik().Grid<MARS_MVC.Models.EditableShow>()
.Name("GridShow")
.DataKeys(keys =>
{
keys.Add(s => s.ShowID);
})
.ToolBar(commands =>
{
commands.Insert().ButtonType(GridButtonType.ImageAndText).ImageHtmlAttributes(new { style = "margin-left:0" });
})
.Columns(columns =>
{
columns.Bound(s => s.Show).Width(100).Title("Show");
columns.Bound(s => s.Industry).Width(100).Title("Industry");
columns.Bound(s => s.IndustryID).Hidden();
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.Image);
}).Width(12).Title("Edit").HtmlAttributes(new { Style="Text-Align:Center" }).HeaderHtmlAttributes(new { Style = "Text-Align:Center" });
columns.Command(commands =>
{
commands.Delete().ButtonType(GridButtonType.Image);
}).Width(12).Title("Delete").HtmlAttributes(new { Style = "Text-Align:Center" }).HeaderHtmlAttributes(new { Style = "Text-Align:Center" });
})
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Select("ShowGrid_Binding", "LookUps")
.Insert("Show_Insert", "LookUps")
.Update("Show_Update", "LookUps")
.Delete("Show_Delete", "LookUps");
})
.Editable(editing => editing.Mode(GridEditMode.PopUp))
.Pageable()
.Sortable()
.Scrollable()
.ClientEvents(events => events.OnEdit("onEdit_BindIndustryDrpList"))
%>
Editor Template:(EditableShow.ascx)
<%= Html.HiddenFor(s => s.ShowID) %>
<table width="290px">
<tr style="height: 20px;">
<td>
<fieldset style="border-color: Gray !important;">
<legend>Show</legend>
<table width="100%" cellspacing="5px" cellpadding="5px">
<tr align="left">
<td width="38%">
Show
</td>
<td width="55%">
<%= Html.EditorFor(s => s.Show) %>
</td>
<td width="7%">
<div style="color: Red;">
<%= Html.ValidationMessageFor(s => s.Show)%></div>
</td>
</tr>
<tr align="left">
<td width="38%">
Industry
</td>
<td width="55%">
<%= Html.EditorFor(s => s.IndustryID) %>
</td>
<td width="7%">
<div style="color: Red;">
<%= Html.ValidationMessageFor(s => s.IndustryID)%></div>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
Client Edit Template:(ShowIndustry.ascx)
<%= Html.Telerik().DropDownList()
.Name("IndustryDrpList")
.BindTo(new SelectList((IEnumerable)ViewData["industries"], "Id", "Name"))
%>
Any help will be appreciated.
Thanks,
Model :(EditableShow.cs)
[KnownType(typeof(EditableShow))]
public class EditableShow
{
[ScaffoldColumn(false)]
public int ShowID{get; set; }
[Required(ErrorMessage = "*")]
[DisplayName("Show")]
public string Show{get; set;}
[UIHint("ShowIndustry"), Required(ErrorMessage = "*")]
public int IndustryID{get; set;}
public string Industry{get; set;}
}
Grid on ascx :(ShowGrid.ascx)
<%= Html.Telerik().Grid<MARS_MVC.Models.EditableShow>()
.Name("GridShow")
.DataKeys(keys =>
{
keys.Add(s => s.ShowID);
})
.ToolBar(commands =>
{
commands.Insert().ButtonType(GridButtonType.ImageAndText).ImageHtmlAttributes(new { style = "margin-left:0" });
})
.Columns(columns =>
{
columns.Bound(s => s.Show).Width(100).Title("Show");
columns.Bound(s => s.Industry).Width(100).Title("Industry");
columns.Bound(s => s.IndustryID).Hidden();
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.Image);
}).Width(12).Title("Edit").HtmlAttributes(new { Style="Text-Align:Center" }).HeaderHtmlAttributes(new { Style = "Text-Align:Center" });
columns.Command(commands =>
{
commands.Delete().ButtonType(GridButtonType.Image);
}).Width(12).Title("Delete").HtmlAttributes(new { Style = "Text-Align:Center" }).HeaderHtmlAttributes(new { Style = "Text-Align:Center" });
})
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Select("ShowGrid_Binding", "LookUps")
.Insert("Show_Insert", "LookUps")
.Update("Show_Update", "LookUps")
.Delete("Show_Delete", "LookUps");
})
.Editable(editing => editing.Mode(GridEditMode.PopUp))
.Pageable()
.Sortable()
.Scrollable()
.ClientEvents(events => events.OnEdit("onEdit_BindIndustryDrpList"))
%>
Editor Template:(EditableShow.ascx)
<%= Html.HiddenFor(s => s.ShowID) %>
<table width="290px">
<tr style="height: 20px;">
<td>
<fieldset style="border-color: Gray !important;">
<legend>Show</legend>
<table width="100%" cellspacing="5px" cellpadding="5px">
<tr align="left">
<td width="38%">
Show
</td>
<td width="55%">
<%= Html.EditorFor(s => s.Show) %>
</td>
<td width="7%">
<div style="color: Red;">
<%= Html.ValidationMessageFor(s => s.Show)%></div>
</td>
</tr>
<tr align="left">
<td width="38%">
Industry
</td>
<td width="55%">
<%= Html.EditorFor(s => s.IndustryID) %>
</td>
<td width="7%">
<div style="color: Red;">
<%= Html.ValidationMessageFor(s => s.IndustryID)%></div>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
Client Edit Template:(ShowIndustry.ascx)
<%= Html.Telerik().DropDownList()
.Name("IndustryDrpList")
.BindTo(new SelectList((IEnumerable)ViewData["industries"], "Id", "Name"))
%>
Any help will be appreciated.
Thanks,