Click here to Skip to main content
15,903,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have query in dynamic row date comparison

I have 8 rows which is created dynamically.I have one column Start Date in this gridview. ID for all this row for start date field is same.Want compare this date field value.First date field value should be less than next date field values in all the rows. I m not getting code in C# that how to implement it.. Please help

There are 10 rows.... In Itemtemplate I have added this textbox
ASP.NET
<asp:TemplateField HeaderStyle-CssClass="TemplateHeader" HeaderText="Planned Start Date">  <itemtemplate>
<asp:TextBox ID="txtPlannedStartdate" runat="server" Text='<%#Eval("pln_start_dt", "{0:dd-MMM-yyyy}")%>' CssClass="TextboxStyle" MaxLength="5" Width="80px">
<cc1:CalendarExtender ID="CalendarExtender1"   runat="server" CssClass="MyCalendar" Format="dd-MMM-yyyy" TargetControlID="txtPlannedStartdate">
 
 </itemtemplate>


I have to apply validation for below row
Posted
Updated 24-Jun-13 19:50pm
v7
Comments
Pheonyx 24-Jun-13 6:59am    
What code do you use to generate these "Dynamic" rows
Use the improve question button to add your code to the question (and use the formatting tools so that it is easily readable).
jaideepsinh 24-Jun-13 8:46am    
Saw you code which you use for binding grid view.
16Sonali 25-Jun-13 1:23am    
public void BindGridPhaseMap(string relID)
{
lblMsg.Text = string.Empty;
try
{
orConn = new OracleConnection(strConn);
if (orConn.State != ConnectionState.Open)
{
orConn.Open();
}

string strSql = string.Empty;
strSql = "SELECT D.PHASE_NAME,C.PHASE_SCOPE,C.PHASE_PROJ_NAME,C.PLN_START_DT,C.PLN_END_DT,C.PLN_EFFORTS ";
strSql += "FROM MTUI_PHASE_MAPPING C,MTUI_PHASE_MASTER D WHERE C.METRICES_RELEASE_ID = '" + relID + "' ";
strSql += "AND C.PHASE_ID=D.PHASE_ID(+) ORDER BY D.PHASE_ID ASC";

DataSet ds = new DataSet();
orCmd = new OracleCommand(strSql, orConn);
da = new OracleDataAdapter(orCmd);
da.Fill(ds);

if (ds.Tables[0].Rows.Count > 0)
{
grdPhaseMap.DataSource = ds;
grdPhaseMap.DataBind();
grdPhaseMap.CssClass = "visible";
}
else
{
for (int i = 1; i <= 15; i++)
{
DataRow dRow = ds.Tables[0].NewRow();
switch (i)
{
case 1:
dRow["PHASE_NAME"] = "Requirement";
break;
case 2 :
dRow["PHASE_NAME"] = "ABC";
break;
case 3:
dRow["PHASE_NAME"] = "aaa";
break;
case 4:
dRow["PHASE_NAME"] = "ads";
break;
case 5:
dRow["PHASE_NAME"] = "ddd";
break;
case 6:
dRow["PHASE_NAME"] = "ggg";
break;
case 7:
dRow["PHASE_NAME"] = "iii";
break;
case 8:
dRow["PHASE_NAME"] = "uuu";
break;
case 9:
dRow["PHASE_NAME"] = "oooo";
break;
case 10:
dRow["PHASE_NAME"] = "hjhj";
break;
case 11:
dRow["PHASE_NAME"] = "gggg";
break;
case 12:
dRow["PHASE_NAME"] = "ppp";
break;
case 13:
dRow["PHASE_NAME"] = "xcxc";
break;
case 14:
dRow["PHASE_NAME"] = "Implementation";
break;
case 15:
dRow["PHASE_NAME"] = "Documentation";
break;
}
ds.Tables[0].Rows.Add(dRow);
}
grdPhaseMap.DataSource = ds;
grdPhaseMap.DataBind();
grdPhaseMap.CssClass = "visible";
}
}
catch (Exception ex)
{
lblMsg.Text = ex.Message.ToString();
}
finally
{
orConn.Close();
orConn.Dispose();
orCmd.Dispose();
da.Dispose();
}
}

1 solution

@Sonali,
Please make your question more clear.
As I understand, you have to sort your all rows in asc order by date.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900