5 Answers, 1 is accepted
0
Accepted

Shinu
Top achievements
Rank 2
answered on 12 Nov 2013, 12:53 PM
Hi Katya,
For such scenarios I recommend using ASP ControlParameter so that you can directly specify the property name in the mark-up. Please check the following sample.
ASPX:
If you want to use ASP Parameter, then you can try the following C# code in the Page_Load event.
C#:
Thanks,
Shinu.
For such scenarios I recommend using ASP ControlParameter so that you can directly specify the property name in the mark-up. Please check the following sample.
ASPX:
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="select OrderID from [Orders] where OrderDate<@Date">
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"RadDatePicker1"
Name
=
"Date"
PropertyName
=
"SelectedDate"
Type
=
"DateTime"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
If you want to use ASP Parameter, then you can try the following C# code in the Page_Load event.
C#:
SqlDataSource1.SelectParameters[
"Date"
].DefaultValue = RadDatePicker1.SelectedDate.ToString();
Thanks,
Shinu.
0

Katya
Top achievements
Rank 1
answered on 12 Nov 2013, 04:47 PM
Hi Shinu,
Thanks for pointing me in the right direction.
Can you please show how to add the same control parameter from the CS page?
Thanks
Thanks for pointing me in the right direction.
Can you please show how to add the same control parameter from the CS page?
Thanks
0

Shinu
Top achievements
Rank 2
answered on 14 Nov 2013, 04:23 AM
Hi Katya,
Please check the sample code I have prepared for your scenario.
ASPX:
C#:
Thanks,
Shinu.
Please check the sample code I have prepared for your scenario.
ASPX:
<
telerik:RadDatePicker
ID
=
"RadDatePicker1"
runat
=
"server"
AutoPostBack
=
"true"
onselecteddatechanged
=
"RadDatePicker1_SelectedDateChanged"
>
</
telerik:RadDatePicker
>
<
br
/>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"true"
DataSourceID
=
"SqlDataSource1"
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="select OrderID, CustomerID, ShipCity from [Orders] where OrderDate<@Date">
</
asp:SqlDataSource
>
C#:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
ControlParameter parameter1 =
new
ControlParameter(
"Date"
,
"RadDatePicker1"
,
"SelectedDate"
);
SqlDataSource1.SelectParameters.Add(parameter1);
}
}
protected
void
RadDatePicker1_SelectedDateChanged(
object
sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
{
RadGrid1.Rebind();
}
Thanks,
Shinu.
0

Don
Top achievements
Rank 1
answered on 24 Jan 2015, 07:21 PM
I recently migrated access db to sql 'backend data file' frontend access. I wanted to use date picker for all dates during data entry. I haven't been able to find the proc in sql after migrating. In access it's very simple 'leave off the xx/xx/xxxx prompt input'. I saw you examples but unable to relate to my request.
Thanks,
Don
Thanks,
Don
0
Hi Don,
I am afraid I am not completely understand your requirement. Could you please provide more details to point you out in the right direction?
Regards,
Kostadin
Telerik
I am afraid I am not completely understand your requirement. Could you please provide more details to point you out in the right direction?
Regards,
Kostadin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.