Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
the following is my code where i think i am making mistake..Convert.ToString(grdSale.SelectedRow.Cells[6].Text), Convert.ToString(grdSale.SelectedRow.Cells[7].Text) both cells[6,7] refer to the dates from gridview that is start date and end date...it should be in dd/MM/yyyy format...code is not getting executed ...may be i am not giving the date in correct format it seems.

ds = admin.AddEntry(Convert.ToString(grdSale.SelectedRow.Cells[0].Text), str6, str9, Convert.ToString(grdSale.SelectedRow.Cells[6].Text), Convert.ToString(grdSale.SelectedRow.Cells[7].Text), Convert.ToString(grdSale.SelectedRow.Cells[4].Text), str8, Convert.ToString(grdSale.SelectedRow.Cells[2].Text), Convert.ToString(grdSale.SelectedRow.Cells[3].Text));
           if (ds != null)
           {
               ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Approved Successfully');", true);

           }
Posted
Updated 15-Feb-13 14:21pm
v2
Comments
Sergey Alexandrovich Kryukov 15-Feb-13 21:45pm    
How about just reading documentation? :-)
—SA

Don't use Convert, use System.DateTime.ToString:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^].

Look at all ToString methods. Pay attention that you can specify a format string of culture (because System.Globalization.CultureInfo implements
IFormatProvider<code>). For format strings, please see:<br />
<a href="http://msdn.microsoft.com/en-us/library/az4se3k1.aspx">http://msdn.microsoft.com/en-us/library/az4se3k1.aspx</a>[<a href="http://msdn.microsoft.com/en-us/library/az4se3k1.aspx" target="_blank" title="New Window">^</a>],<br />
<a href="http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx">http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx</a>[<a href="http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx" target="_blank" title="New Window">^</a>].<br />
<br />
That's all you need.<br />
<br />
<dd>—SA</dd>
 
Share this answer
 
Don't use Convert, use System.DateTime.ToString:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^].

Look at all ToString methods. Pay attention that you can specify a format string of culture (because System.Globalization.CultureInfo implements
IFormatProvider<code>). For format strings, please see:<br />
<a href="http://msdn.microsoft.com/en-us/library/az4se3k1.aspx">http://msdn.microsoft.com/en-us/library/az4se3k1.aspx</a>[<a href="http://msdn.microsoft.com/en-us/library/az4se3k1.aspx" target="_blank" title="New Window">^</a>],<br />
<a href="http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx">http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx</a>[<a href="http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx" target="_blank" title="New Window">^</a>].<br />
<br />
That's all you need.<br />
<br />
<dd>—SA</dd>
 
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