Hi,
I am using RadclientDatasource to bind data unto grid. it is working fine. but i want to pass parameter based on selection. Please check my code and let me know how to pass parameter while selecting and Inserting
<telerik:RadClientDataSource ID="RadClientDataSource1" runat="server" AllowBatchOperations="True">
<ClientEvents OnCustomParameter="ParameterMap" OnDataParse="Parse" OnRequestFailed="rg_OnRequestFailed" />
<DataSource>
<WebServiceDataSourceSettings BaseUrl="/BackStage/BackStageWCFService.svc/">
<Select Url="getLocation" DataType="JSON" />
<Insert Url="InsertLocation" DataType="JSON" />
</WebServiceDataSourceSettings>
</DataSource>
<Schema>
<Model ID="att_typ_id">
<telerik:ClientDataSourceModelField FieldName="prt_loc_id" DataType="Number" />
<telerik:ClientDataSourceModelField FieldName="effective_date" DataType="Date" />
<telerik:ClientDataSourceModelField FieldName="termination_date" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="rep_loc_code" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="rep_loc_id" DataType="Number" />
<telerik:ClientDataSourceModelField FieldName="pln_prt_id" DataType="Number" />
</Model>
</Schema>
</telerik:RadClientDataSource>
Javascript
-------------
function ParameterMap(sender, args) {
if (args.get_type() == "read") {
args.set_parameterFormat({ customersJSON: kendo.stringify(args.get_data().models) });
}
}
Appcode
-------------
<WebGet()> _
<AspNetCacheProfile("NoCache")> _
Public Function getLocation() As LocationResult
Dim entities As New EnrollmentEntities()
Return New LocationResult() With { _
.Data = entities.PART_REPORTING_LOCATIONS.Where(Function(d) d.PRT_LOC_ID = Here need to pass parameter).ToList().[Select](Function(c) New ServiceLocations() With { _
.prt_loc_id = c.PRT_LOC_ID, _
.termination_date = If(HttpUtility.HtmlEncode(c.TERMINATION_DATE) IsNot Nothing, HttpUtility.HtmlEncode(c.TERMINATION_DATE.Value.ToString("MM-dd-yyyy")), ""), _
.effective_date = c.EFFECTIVE_DATE, _
.rep_loc_code = HttpUtility.HtmlEncode(c.LEVEL_REP_LOC.REP_LOC_CODE), _
.rep_loc_id = c.REP_LOC_ID, _
.pln_prt_id = c.PLN_PRT_ID _
}).ToList(), _
.Count = 100 _
}
End Function
Please check my code and help ASAP
Thanks in advance,
Dhamu
I am using RadclientDatasource to bind data unto grid. it is working fine. but i want to pass parameter based on selection. Please check my code and let me know how to pass parameter while selecting and Inserting
<telerik:RadClientDataSource ID="RadClientDataSource1" runat="server" AllowBatchOperations="True">
<ClientEvents OnCustomParameter="ParameterMap" OnDataParse="Parse" OnRequestFailed="rg_OnRequestFailed" />
<DataSource>
<WebServiceDataSourceSettings BaseUrl="/BackStage/BackStageWCFService.svc/">
<Select Url="getLocation" DataType="JSON" />
<Insert Url="InsertLocation" DataType="JSON" />
</WebServiceDataSourceSettings>
</DataSource>
<Schema>
<Model ID="att_typ_id">
<telerik:ClientDataSourceModelField FieldName="prt_loc_id" DataType="Number" />
<telerik:ClientDataSourceModelField FieldName="effective_date" DataType="Date" />
<telerik:ClientDataSourceModelField FieldName="termination_date" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="rep_loc_code" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="rep_loc_id" DataType="Number" />
<telerik:ClientDataSourceModelField FieldName="pln_prt_id" DataType="Number" />
</Model>
</Schema>
</telerik:RadClientDataSource>
Javascript
-------------
function ParameterMap(sender, args) {
if (args.get_type() == "read") {
args.set_parameterFormat({ customersJSON: kendo.stringify(args.get_data().models) });
}
}
Appcode
-------------
<WebGet()> _
<AspNetCacheProfile("NoCache")> _
Public Function getLocation() As LocationResult
Dim entities As New EnrollmentEntities()
Return New LocationResult() With { _
.Data = entities.PART_REPORTING_LOCATIONS.Where(Function(d) d.PRT_LOC_ID = Here need to pass parameter).ToList().[Select](Function(c) New ServiceLocations() With { _
.prt_loc_id = c.PRT_LOC_ID, _
.termination_date = If(HttpUtility.HtmlEncode(c.TERMINATION_DATE) IsNot Nothing, HttpUtility.HtmlEncode(c.TERMINATION_DATE.Value.ToString("MM-dd-yyyy")), ""), _
.effective_date = c.EFFECTIVE_DATE, _
.rep_loc_code = HttpUtility.HtmlEncode(c.LEVEL_REP_LOC.REP_LOC_CODE), _
.rep_loc_id = c.REP_LOC_ID, _
.pln_prt_id = c.PLN_PRT_ID _
}).ToList(), _
.Count = 100 _
}
End Function
Please check my code and help ASAP
Thanks in advance,
Dhamu