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

RadDatePicker inside DataList

1 Answer 63 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Mohammed Ahmed
Top achievements
Rank 1
Mohammed Ahmed asked on 03 Jan 2009, 02:32 AM
I want to save the the selected date from the RadDataPicker within the datalist to the database here is the code I have

from aspx side

 

<asp:DataList ID="someid" runat="server" RepeatLayout="Table" ItemStyle-Width="300px"

 

 

RepeatColumns="2" RepeatDirection="Vertical"

 

 

DataKeyField="somekeydata" >

 

 

<HeaderTemplate>

 

 

<table>

 

 

<tr>

 

 

<td class="label" colspan="8">

 

some info

 

</td>

 

 

</tr>

 

 

</table>

 

 

</HeaderTemplate>

 

 

<ItemStyle />

 

 

 

<ItemTemplate>

 

 

<asp:Label ID="someid2" runat="server" Text=<%#Eval("somedata")%>></asp:Label>

 

 

<asp:Label ID="someid3" runat="server" Text=<%#Eval("somedata")%> ></asp:Label>:

 

 

 

<img id="someid4" runat="server" src="images/someimage.gif" alt="some alt." align="absmiddle"

 

 

border="0" height="10" />

 

 

<telerik:RadDatePicker ID="RadDate1" Runat="server" DbSelectedDate='<%#Bind("dates")%>' >

 

 

</telerik:RadDatePicker>

 

 

</ItemTemplate>

 

 

</asp:DataList>

Cs file

 

 

private RadDatePicker getdate= new RadDatePicker();

 

 

 

protected

 

void Save_Click(object sender, EventArgs e)

 

{

 

 

 

 

foreach (DataListItem ls in someid.Items)

 

{

 

int key= (int)someid.DataKeys[ls.ItemIndex];

 

getdate= (

RadDatePicker)ls.FindControl("RadDate1");

 

 

object somevariable = Convert.ToDateTime(getdate.SelectedDate); //each time the date is null

 

 

 

 

 

 

 

}

 

 

}

I really appreciate for your help.

Thanks

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 07 Jan 2009, 06:39 AM
Hello Mohammed,

One possible option in this case would be to use the client side api of the control, and trigger an AjaxRequest to the server. For example, when a selection is made, you can go to the server via an AjaxRequest, and persist the selected value in the database, or add it to the list.

Best wishes,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Calendar
Asked by
Mohammed Ahmed
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or