In my edit template, i am trying to bind the items to the Textbox for editing, this does not work and I am left with a blank textbox. I am data binding on a datatable. the item template shows the data correctly, I then have to hit the edit button twice(dunno why) then i see the 3 empty text boxes. Any help is appreciated.
//Code Behind file
dt = new DataTable();
dt.Columns.Add("SummaryID");
dt.Columns.Add("BegTimeStamp");
dt.Columns.Add("EndTimeStamp");
DataRow dr = dt.NewRow();
dr["SummaryID"] = "Rule 1";
dr["BegTimeStamp"] = "5/21/2010 6:00:00 AM";
dr["EndTimeStamp"] = "5/24/2010 6:00:00 PM";
dt.Rows.Add(dr);
protected void ruleLV_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
{
ruleLV.DataSource = dt;
}
//end code behind
<telerik:RadListView ID="ruleLV" runat="server"
ItemPlaceholderID="RulePlaceHolder"
onneeddatasource="ruleLV_NeedDataSource" Skin="Windows7"
onselectedindexchanged="ruleLV_SelectedIndexChanged"
onitemcommand="ruleLV_ItemCommand" DataKeyNames="SummaryID"
>
<LayoutTemplate>
<table runat="server" >
<tr>
<th id="SummaryIdHdr" runat="server" width="150px">Rule ID</th>
<th id="BegTimeStampHdr" runat="server" width="200px">Start Date/Time</th>
<th id="EndTimeStampHdr" runat="server" width="200px">End Date/Time</th>
</tr>
<tr id="RulePlaceHolder" runat="server" ></tr>
</table>
<fieldset style="text-align: center; background-color: white;">
</fieldset>
</LayoutTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("SummaryID") %>'></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("BegTimeStamp") %>'></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("EndTimeStamp") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<tr ID="rules" bgColor="White" runat="server">
<td> <%#Eval("SummaryID") %></td>
<td> <%#Eval("BegTimeStamp") %></td>
<td> <%#Eval("EndTimeStamp") %></td>
<td><asp:Button Id="EditButton" Text="Edit" runat="server" CommandName="Edit" /> </td>
</tr >
</ItemTemplate>
</telerik:RadListView>
//Code Behind file
dt = new DataTable();
dt.Columns.Add("SummaryID");
dt.Columns.Add("BegTimeStamp");
dt.Columns.Add("EndTimeStamp");
DataRow dr = dt.NewRow();
dr["SummaryID"] = "Rule 1";
dr["BegTimeStamp"] = "5/21/2010 6:00:00 AM";
dr["EndTimeStamp"] = "5/24/2010 6:00:00 PM";
dt.Rows.Add(dr);
protected void ruleLV_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
{
ruleLV.DataSource = dt;
}
//end code behind
<telerik:RadListView ID="ruleLV" runat="server"
ItemPlaceholderID="RulePlaceHolder"
onneeddatasource="ruleLV_NeedDataSource" Skin="Windows7"
onselectedindexchanged="ruleLV_SelectedIndexChanged"
onitemcommand="ruleLV_ItemCommand" DataKeyNames="SummaryID"
>
<LayoutTemplate>
<table runat="server" >
<tr>
<th id="SummaryIdHdr" runat="server" width="150px">Rule ID</th>
<th id="BegTimeStampHdr" runat="server" width="200px">Start Date/Time</th>
<th id="EndTimeStampHdr" runat="server" width="200px">End Date/Time</th>
</tr>
<tr id="RulePlaceHolder" runat="server" ></tr>
</table>
<fieldset style="text-align: center; background-color: white;">
</fieldset>
</LayoutTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("SummaryID") %>'></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("BegTimeStamp") %>'></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("EndTimeStamp") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<tr ID="rules" bgColor="White" runat="server">
<td> <%#Eval("SummaryID") %></td>
<td> <%#Eval("BegTimeStamp") %></td>
<td> <%#Eval("EndTimeStamp") %></td>
<td><asp:Button Id="EditButton" Text="Edit" runat="server" CommandName="Edit" /> </td>
</tr >
</ItemTemplate>
</telerik:RadListView>