I have data table in C# and in that I have multiple column in that date column contain repeated date for multiple rows so I have arranged data date desc now i want to print date if date is repeated then it should come with empty value
I have data table data as
# Challan Date Item Name Item Code UMO
CHWe216495 10/Mar/2018 TABLE ppppp 44cvc
CHWe216495 10/Mar/2018 TABLE SHARP qqqq 211dd
CHWe216495 10/Mar/2018 TABLE SHARPNER rrrr 54lo
CHWe216496 11/Mar/2018 TABLE E M.S SOFF mmmm 1235
CHWe216496 11/Mar/2018 TABLE SHARPENER - nnnn p123
CHWe216496 11/Mar/2018 TABLE SHARPNER asdf mop12
and so on
I am displaying this data in table for that I created string in which i created table using string builder now I want data as following
<pre><pre> # Challan Date Item Name Item Code UMO
CHWe216495 10/Mar/2018 TABLE ppppp 44cvc
CHWe216495 TABLE SHARP qqqq 211dd
CHWe216495 TABLE SHARPNER rrrr 54lo
CHWe216496 11/Mar/2018 TABLE E M.S SOFF mmmm 1235
CHWe216496 TABLE SHARPENER - nnnn p123
CHWe216496 TABLE SHARPNER asdf mop12
but it is showing data as in my solution
<pre><pre> # Challan Date Item Name Item Code UMO
CHWe216495 10/Mar/2018 TABLE ppppp 44cvc
CHWe216495 TABLE SHARP qqqq 211dd
CHWe216495 10/Mar/2018 TABLE SHARPNER rrrr 54lo
CHWe216496 11/Mar/2018 TABLE E M.S SOFF mmmm 1235
CHWe216496 TABLE SHARPENER - nnnn p123
CHWe216496 11/Mar/2018 TABLE SHARPNER asdf mop12
which is incorrect please provide solution
What I have tried:
string StrprevChallanDate=string.empty;
if (dtJobWork4 != null)
{
for (int i = 0; i < dtJobWork4.Rows.Count; i++)
{
if (dtJobWork4.Rows[i]["ChallanDate"] != null)
{
StrChallanDate = DateTime.Parse(dtJobWork4.Rows[i]["ChallanDate"].ToString()).ToString("dd/MMM/yyyy");
}
if (StrprevChallanDate != "")
{
if (StrprevChallanDate != StrChallanDate)
{
StrChallanDate = DateTime.Parse(dtJobWork4.Rows[i]["ChallanDate"].ToString()).ToString("dd/MMM/yyyy");
}
else
{
StrChallanDate = "";
}
}
if (dtJobWork4.Rows[i]["ItemId"] != null)
{
StrItemId = dtJobWork4.Rows[i]["ItemId"].ToString();
}
if (dtJobWork4.Rows[i]["ItemName"] != null)
{
StrItemName = dtJobWork4.Rows[i]["ItemName"].ToString();
}
StrItemName = funSplit(StrItemName, 20);
if (dtJobWork4.Rows[i]["ItemCode"] != null)
{
StrItemCode = dtJobWork4.Rows[i]["ItemCode"].ToString();
}
if (dtJobWork4.Rows[i]["HSNCode"] != null)
{
StrHSNCode = dtJobWork4.Rows[i]["HSNCode"].ToString();
}
if (dtJobWork4.Rows[i]["UOM"] != null)
{
StrUOM = dtJobWork4.Rows[i]["UOM"].ToString();
}
if (dtJobWork4.Rows[i]["Qty"] != null)
{
strtbl4quantity = dtJobWork4.Rows[i]["Qty"].ToString();
}
if (dtJobWork4.Rows[i]["Rate"] != null)
{
strtbl4Rate = dtJobWork4.Rows[i]["Rate"].ToString();
}
if (dtJobWork4.Rows[i]["Amount"] != null)
{
strtbl4Amount = dtJobWork4.Rows[i]["Amount"].ToString();
}
strLblTbl.Append("<table cellspacing='0' cellpadding='0' style='width:800px; border-bottom:none; border-left:solid 1px silver; border-right:solid 1px silver'>");
strLblTbl.Append("<tr>");
strLblTbl.Append("<td style= 'height:18px;width:90px; border-bottom:solid 1px silver; border-right:solid 1px silver;text-indent:5px; ' align = 'left'>" + StrChallanId + "</td>");
strLblTbl.Append("<td style=' height:18px;width:100px; border-bottom:solid 1px silver; border-right:solid 1px silver;' align = 'left'><div style='margin-left:5px;'>" + StrChallanDate + "</div></td>");
strLblTbl.Append("<td style=' height:18px;width:150px; border-bottom:solid 1px silver; border-right:solid 1px silver;' align = 'left'><div style='margin-left:5px;'>" + StrItemName + "</div></td>");
strLblTbl.Append("<td style=' height:18px;width:70px; border-bottom:solid 1px silver; border-right:solid 1px silver; text-indent:5px;' align = 'left'>" + StrItemCode + "</td>");
strLblTbl.Append("<td style=' height:18px;width:70px; border-bottom:solid 1px silver; border-right:solid 1px silver; text-indent:5px;' align = 'left'>" + StrUOM + "</td>");
strLblTbl.Append("<td style=' height:18px;width:80px; border-bottom:solid 1px silver; border-right:solid 1px silver;text-indent:5px; ' >" + StrHSNCode + " </td>");
strLblTbl.Append("<td style=' height:18px;width:80px; border-bottom:solid 1px silver; border-right:solid 1px silver;text-indent:5px;' align = 'right'>" + currencyConverter(Math.Abs(Dectbl4Qty)) + " </td>");
strLblTbl.Append("<td style=' height:18px;width:80px; border-bottom:solid 1px silver; border-right:solid 1px silver;text-indent:5px; ' align = 'right'>" + currencyConverter(GetTwoDecimalValue(Math.Abs(Dectbl4Rate))) + " </td>");
strLblTbl.Append("<td style=' height:18px;width:80px; border-bottom:solid 1px silver;text-indent:5px;' align = 'right'>" + currencyConverter(Math.Abs(Dectbl4Amount)) + " </td>");
strLblTbl.Append("</tr>");
strLblTbl.Append("</table>");
StrprevChallanDate = StrChallanDate;
}
}