narasiman rao

narasiman rao

  • NA
  • 519
  • 746.7k

How to validate the repeater control in asp.net using c#

Apr 24 2014 8:11 AM
   My source page code as follows
<div>
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table border="0" width="600px" cellpadding="2" cellspacing="1" style="border: 1px solid maroon;">
<tr bgcolor="maroon">
<th>
course</th>
<th>
Courseamt</th>
<th>
Coursedate</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td width="100">
<%# DataBinder.Eval(Container, "DataItem.course")%>
</td>
<td>
<%# DataBinder.Eval(Container, "DataItem.Courseamt")%>
</td>
<td width="150">
<%# DataBinder.Eval(Container, "DataItem.Coursedate")%>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr bgcolor="#e8e8e8">
<td width="100">
<%# DataBinder.Eval(Container, "DataItem.course")%>
</td>
<td>
<%# DataBinder.Eval(Container, "DataItem.Courseamt")%>
</td>
<td width="150">
<%# DataBinder.Eval(Container, "DataItem.Coursedate")%>
</td>>
</tr>
</AlternatingItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
&nbsp; &nbsp;
<asp:Button ID="Submit" runat="server" OnClick="Submit_Click" />

<div style="font-size:14px; color:Navy">
&nbsp;</div>
</div>
 Apsx code as follows
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Server=(local);initial catalog=Himt_Testing;Trusted_Connection=True");
string str;
SqlCommand cmd = new SqlCommand("select * from Tb_Course_details", con);
cmd.Connection.Open();
Repeater1.DataSource = cmd.ExecuteReader();
Repeater1.DataBind();
cmd.Connection.Close();
}
  Output as follows
   
    Coursename         Amount        Coursedate
        RPST                 500             29   Apr  2014
        RPSCRB           600              30  APr   2014


   
i have one button called submit. when i click the submit button i wan to validate the RPST and RPSCRB date must be the same date.
 for that how can i validate in asp.net using c#.
Regards,
Narasiman P.

Answers (1)