samit kaneriya

samit kaneriya

  • 1.7k
  • 41
  • 3.9k

Problem to bind first value in ItemTemplate of repeater using MaskedEditExtender

Oct 19 2011 7:34 AM
i am using repeater control under repeater bind textbox and its value is time format then i am using MaskedEditExtender for time format when ever first data bind then javascript error occured





This is my aspx page code:
----------------------------
<asp:Repeater ID="rptTime" runat="server">
  <ItemTemplate>
  <table>
  <tr>
  <td align="left" style="width: 100px;">
  <asp:Label ID="lblday" runat="server"></asp:Label>
  </td>
  <td>
  <asp:TextBox ID="txtTimeFrom" Text='<%#Eval("starttime") %>' runat="server"></asp:TextBox>
  <asp:MaskedEditExtender ID="MaskedEditExtender1" AcceptAMPM="true" MaskType="Time"
  Mask="99.99" TargetControlID="txtTimeFrom" runat="server">
  </asp:MaskedEditExtender>
  </td>
  <td>
  <asp:TextBox ID="TxtTimeTo" Text='<%#Eval("endtime") %>' runat="server"></asp:TextBox>
  <asp:MaskedEditExtender ID="MaskedEditExtender3" AcceptAMPM="true" MaskType="Time"
  Mask="99.99" TargetControlID="TxtTimeTo" runat="server">
  </asp:MaskedEditExtender>
  </td>
  </tr>
  </table>
  </ItemTemplate>
  </asp:Repeater>


My CS Code:-
--------------
 DataTable dt = new DataTable();
  dt.Columns.Add("date", typeof(String));
  dt.Columns.Add("starttime", typeof(String));
  dt.Columns.Add("endtime", typeof(String));
 
  DataRow r ;
  r = dt.NewRow();
  r["date"] = "sunday";
  r["starttime"] = "10:00 AM";
  r["endtime"] = "12:00 AM";
  dt.Rows.Add(r);

  r = dt.NewRow();
  r["date"] = "Monday";
  r["starttime"] = "01:00 AM";
  r["endtime"] = "03:00 AM";
  dt.Rows.Add(r);

  r = dt.NewRow();
  r["date"] = "Tuesday";
  r["starttime"] = "05:00 AM";
  r["endtime"] = "06:00 AM";
  dt.Rows.Add(r);
 
  rptTime.DataSource = dt;
  rptTime.DataBind();

Answers (2)