hi,
we need to have a kendo ui mvc grid with dynamic columns binding, also each column has a specific format and name.
i've created a view model like so
public class ReportGridColumnsViewModel
{
public DataTable GridColumns { get; set; }
public Dictionary<string, ColumnProperty> ColumnData{ get; set; }
}
}
the question is, how i do pass this view model from controller method, how do i use ToDataSourceResult with that, i do i not:
below wont work, because gridData is ReportGridColumnsViewModel, not IQueriable
public virtual ActionResult GridData([DataSourceRequest]DataSourceRequest request, ReportGridViewModel viewModel)
{
var gridData = _transformer.GetGridData(viewModel, SessionUser);
Session["KendoTradeAckGrid"] = gridData;
return Json(gridData.ToDataSourceResult(request));
}
we are using ajax as data source in grid.
thanks,
Inna
Not sure that the MaskedTextBox is the right control to use
for this, but here goes:
I need to have an input for an email address that:
A) Is a hyperlink to start an email with displayed email
address as the "To:" address.
AND
B) Allow the user to edit the email address if they so
desire.
So, first, I need to have it appear as a link that can be
edited,
Second, I need to know what I would use for a mask (assuming
that this is the right control for this)
Can anyone point me in the right directions?
TIA,
Bob Mathis
Ive a scheduler with a custom editor template. The template displays a MultiSelect whose selectable values will differ depending upon what specific event is picked. So when I click an event I capture the Edit event and I refresh the MultiSelect to populate its selecteble values and this works.
$('#PrerequisiteOids').data('kendoMultiSelect').dataSource.read();
However my selected values from my model are never set in the control. I'm guessing this is something to do with it being in a Template - how do I bind my values from the selected Event?
The MultiSelect in the Template looks like this:
@(Html.Kendo().MultiSelectFor(model => model.Prerequisites)
.Name("Prerequisites")
.AutoBind(true)
.DataTextField("Title")
.DataValueField("Oid")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetPrerequisites", "CourseCalendar").Data("getCourseEventID");
})
.ServerFiltering(true);
})
.HtmlAttributes(new { @class = "universalWidth" }))
Has
Hello,
I'm trying to use the toolbar as a workaround to the Rad Ribbon for Asp.Net Ajax: http://demos.telerik.com/aspnet-ajax/ribbonbar/examples/tooltip/defaultcs.aspx
that is not available in MVC. Where i am struggling is how to create headers/labels for each toolbar section like the Ribbon example (Clipboard, Font, Paragraph, Editing...) that will go on top (or bottom). Are there any examples of this, or is this even possible?
Thanks in advance,
Dave
Hello,
I am working with Kendo Scheduler. I want to set my work week to start at Sunday and end at Thursday.
I wrote the following code to define work week start and end.
.WorkWeekStart(-7)
.WorkWeekEnd(-3)
Now, my work week is displaying fine, but i have problem with navigation trough work weeks. This navigator doesn't work. When I click forward it doesn't respond at all, also when I click back, it jumps for two weeks back. All other navigators are working fine (day, month, agenda).
When I try
.WorkWeekStart(0)
.WorkWeekEnd(4)
today button redirects me to next week.
Hello all,
I am new to both Telerik and MVC and need help desperately.
I have built a grid that is populated by data query upon load. I added a custom column with a button (Create Affidavit) to my grid with a .Click command pointing to jquery function sendVisibleRows.
Upon clicking the row’s “Create Affidavit” button, I wish to capture all the data in the “clicked” row and pass each column value and format them separately to local variables that I use to dynamically populate a form.
I’ve tried numerous methods but I cannot seem to be able to capture the data in the clicked row. No matter what I do, I seem to only be able to capture the columns in the very first row.
I also tried without success:
var row =
this.select();
var id =
row.data("id");
Any help is extremely welcome. Thank you!
<div class=
"container"
>
<div class=
"col-lg-6"
>
@(Html.Kendo().Grid<IntranetPolice.Models.AffDataTbl>()
.Name(
"Grid"
)
.Columns(columns =>
{
columns.Bound(p => p.inci_id).Title(
"Svc Number"
).Width(80);
columns.Bound(p => p.arr_chrg).Title(
"Charge"
).Width(80);
columns.Bound(p => p.lastname).Title(
"Last Name"
).Width(80);
columns.Bound(p => p.firstname).Title(
"First Name"
).Width(80);
columns.Bound(p => p.street).Title(
"Street"
).Width(80);
columns.Command(command => command.Custom(
"Create Affidavit"
).Click(
"sendVisibleRows"
)).Width(80);
})
.HtmlAttributes(
new
{ style =
"height: 550px;"
})
//.Pageable(pageable => pageable
// .Input(true)
// .Numeric(false)
// )
.Sortable()
.Scrollable(scr => scr.Height(430))
//.Filterable()
.DataSource(dataSource => dataSource
// Configure the grid data source
.Ajax()
// Specify that ajax binding is used
.Read(read => read.Action(
"Affidavit_Read"
,
"Home"
).Data(
"sendAddtionalData"
))
)
)
</div>
<div class=
"col-lg-6"
>
<div class=
"panel"
align=
"center"
>
@using (Html.BeginForm(
"Affidavit_PDF"
,
"Home"
, FormMethod.Post,
new
{ target =
"_blank"
}))
{
@Html.AntiForgeryToken()
<form id=
"arraignmentForm"
>
<ul id=
"fieldlist"
>
<li><center><h4>Arraignment Form</h4></center></li>
<li>
<p>
@Html.TextBoxFor(m => m.inci_id,
new
{ id =
"inci_id"
, @class =
"TextBoxFor_txtcolor"
, @onclick =
""
})
@Html.TextBoxFor(m => m.lastname,
new
{ id =
"lastname"
, @class =
"TextBoxFor_txtcolor"
, @onclick =
""
})
@Html.TextBoxFor(m => m.firstname,
new
{ id =
"firstname"
, @class =
"TextBoxFor_txtcolor"
, @onclick =
""
})
@Html.TextBoxFor(m => m.chrgdesc,
new
{ id =
"chrgdesc"
, @class =
"TextBoxFor_txtcolor"
, @onclick =
""
})
@Html.TextBoxFor(m => m.statute,
new
{ id =
"statute"
, @class =
"TextBoxFor_txtcolor"
, @onclick =
""
})
@Html.TextAreaFor(m => m.supplement,
new
{ id =
"supplement"
, @class =
"TextBoxFor_txtcolor"
, @onclick =
""
})
</p>
@Html.HiddenFor(m => m.date_occu,
new
{ id =
"date_occu"
})
@Html.HiddenFor(m => m.armainid,
new
{ id =
"armainid"
})
@Html.HiddenFor(m => m.archrgArmainid,
new
{ id =
"archrgArmainid"
})
@Html.HiddenFor(m => m.archrgid,
new
{ id =
"archrgid"
})
@Html.HiddenFor(m => m.chargetype,
new
{ id =
"chargetype"
})
@Html.HiddenFor(m => m.arr_chrg,
new
{ id =
"arr_chrg"
})
@Html.HiddenFor(m => m.bondamt,
new
{ id =
"bondamt"
})
@Html.HiddenFor(m => m.fel_misd,
new
{ id =
"fel_misd"
})
@Html.HiddenFor(m => m.race,
new
{ id =
"race"
})
@Html.HiddenFor(m => m.sex,
new
{ id =
"sex"
})
@Html.HiddenFor(m => m.dob,
new
{ id =
"dob"
})
@Html.HiddenFor(m => m.height,
new
{ id =
"height"
})
@Html.HiddenFor(m => m.weight,
new
{ id =
"weight"
})
@Html.HiddenFor(m => m.hair,
new
{ id =
"hair"
})
@Html.HiddenFor(m => m.eye,
new
{ id =
"eye"
})
@Html.HiddenFor(m => m.streetnbr,
new
{ id =
"streetnbr"
})
@Html.HiddenFor(m => m.street,
new
{ id =
"street"
})
@Html.HiddenFor(m => m.city,
new
{ id =
"city"
})
@Html.HiddenFor(m => m.state,
new
{ id =
"state"
})
@Html.HiddenFor(m => m.zip,
new
{ id =
"zip"
})
@Html.HiddenFor(m => m.dr_lic,
new
{ id =
"dr_lic"
})
@Html.HiddenFor(m => m.dl_state,
new
{ id =
"dl_state"
})
@Html.HiddenFor(m => m.name_id,
new
{ id =
"name_id"
})
@Html.HiddenFor(m => m.ofcName,
new
{ id =
"ofcName"
})
@Html.HiddenFor(m => m.selectCounty,
new
{ id =
"selectCounty"
})
</li>
<li class=
"confirm"
>
<button class=
"k-button k-primary"
type=
"submit"
>Arraignment Form</button>
</li>
</ul>
</form>
}
</div>
</div>
</div>
<script>
function
sendAddtionalData() {
var
caseNum =
'@(ViewBag.caseNum)'
;
return
{
caseNum: caseNum,
};
}
function
sendVisibleRows(e) {
var
grid = $(
"#Grid"
).data(
"kendoGrid"
).dataSource.get();
//pulling data from selected grid column
//var t = grid.dataItem(grid.select());
var
jgrid = JSON.stringify(grid);
//converting the data received into JSON format
var
jgrid_obj = eval(
"("
+ jgrid +
")"
)
//creating object with JSON datafields
$.ajax({
type:
"POST"
,
dataType:
"json"
,
contentType:
"application/json; charset=utf-8"
,
url:
'@Url.Action("Affidavit_Create", "Home")'
,
async:
true
,
processData:
false
,
data: jgrid,
//JSON.stringify(grid),
success:
function
(json) {
if
(json.pass) {
var
ofcName =
'@(ViewBag.ofcname)'
;
var
selectCounty =
'@(ViewBag.selectCounty)'
;
var
inci_id = jgrid_obj.inci_id;
var
date_occu = jgrid_obj.date_occu;
var
armainid = jgrid_obj.armainid;
var
archrgArmainid = jgrid_obj.archrgArmainid;
var
chrgdesc = jgrid_obj.chrgdesc;
var
archrgid = jgrid_obj.archrgid;
var
chargetype = jgrid_obj.chargetype;
var
arr_chrg = jgrid_obj.arr_chrg;
var
bondamt = jgrid_obj.bondamt;
var
fel_misd = jgrid_obj.fel_misd;
var
statute = jgrid_obj.statute;
var
lastname = jgrid_obj.lastname;
var
firstname = jgrid_obj.firstname;
var
race = jgrid_obj.race;
var
sex = jgrid_obj.sex;
var
dob = jgrid_obj.dob;
var
height = jgrid_obj.height;
var
weight = jgrid_obj.weight;
var
hair = jgrid_obj.hair;
var
eye = jgrid_obj.eye;
var
streetnbr = jgrid_obj.streetnbr;
var
street = jgrid_obj.street;
var
city = jgrid_obj.city;
var
state = jgrid_obj.state;
var
zip = jgrid_obj.zip;
var
dr_lic = jgrid_obj.dr_lic;
var
dl_state = jgrid_obj.dl_state;
var
name_id = jgrid_obj.name_id;
var
supplement = jgrid_obj.supplement;
/////sending variables to Form
$(
"#ofcName"
).val(ofcName);
$(
"#selectCounty"
).val(selectCounty);
$(
"#inci_id"
).val(inci_id);
$(
"#lastname"
).val(lastname);
$(
"#firstname"
).val(firstname);
$(
"#supplement"
).val(supplement);
$(
"#chrgdesc"
).val(chrgdesc);
$(
"#statute"
).val(statute);
$(
"#date_occu"
).val(date_occu);
$(
"#armainid"
).val(armainid);
$(
"#archrgArmainid"
).val(archrgArmainid);
$(
"#archrgid"
).val(archrgid);
$(
"#chargetype"
).val(chargetype);
$(
"#arr_chrg"
).val(arr_chrg);
$(
"#bondamt"
).val(bondamt);
$(
"#fel_misd"
).val(fel_misd);
$(
"#race"
).val(race);
$(
"#sex"
).val(sex);
$(
"#dob"
).val(dob);
$(
"#height"
).val(height);
$(
"#weight"
).val(weight);
$(
"#hair"
).val(hair);
$(
"#eye"
).val(eye);
$(
"#streetnbr"
).val(streetnbr);
$(
"#street"
).val(street);
$(
"#city"
).val(city);
$(
"#state"
).val(state);
$(
"#zip"
).val(zip);
$(
"#dr_lic"
).val(dr_lic);
$(
"#dl_state"
).val(dl_state);
$(
"#name_id"
).val(name_id);
}
},
error:
function
(XMLHttpRequest, textStatus, errorThrown) {
alert(
"Error"
);
}
});
}
</script>
I want to create my own action buttons for each row in the grid using gylypicon images. I've used previous posts in this forum as a guideline for what to do,but the solutions offered (here and here) appear to be no longer supported. I can get the custom buttons to appear without any issue, but there's no icon (when a name value is specified), nor does there seem to be a way to just show an icon (we're using Bootstrap gylphicons and want to use them for the action buttons as well).
Here's how I'm creating the rows in the grid (I have additional command buttons, but they're the same as that below):
01.
columns: [
02.
{ field:
"id"
, title:
"Id"
, hidden:
false
},
03.
{ field:
"parentId"
, hidden:
true
},
04.
{ field:
"Title"
, hidden:
false
},
05.
{ field:
"Body"
, hidden:
false
},
06.
{ field:
"NoteCreator"
, hidden:
true
},
07.
{ field:
"CreatedBy"
, title:
"Created By"
, hidden:
false
},
08.
{ field:
"CreatedDate"
, title:
"Created On"
, hidden:
false
},
09.
{ field:
"Replies"
, hidden:
true
},
10.
{ field:
"IsRoot"
, hidden:
true
},
11.
{ field:
"Token"
, hidden:
true
},
12.
{
13.
field:
"Actions"
, hidden:
false
,
14.
command: [{
15.
name:
" "
,
16.
click:
function
(e) {
17.
// e.target is the DOM element representing the button
18.
var
tr = $(e.target).closest(
"tr"
);
19.
// get the data bound to the current table row
20.
var
data =
this
.dataItem(tr);
21.
alert(
"View for id "
+ data.id +
"."
);
22.
}
23.
}]
24.
],
The first file (action-buttons-no-icons.png) shows what it looks like; the second file (action-buttons-icons-only.png) shows what I *want* it to look like.
I have this code for an autocomplete for possible recomendations, but when I want type a custom name, the plugin delete my characteres
@(Html.Kendo().MultiSelect()
.Name("EmailInvited")
.AutoClose(false)
.Placeholder("Write the name or email")
.BindTo(Model.RecomendationList)
.DataTextField("Invited")
.DataValueField("Email")
)