Help Please
-
I am using a textbox to insert time into a databse table "SQL Server", The column data type in the table is datetime. When i insert it an run the page i see the date 1/1/1900 in the GridView but i don't want it to appear. What should i do to solve this problem. Thanx in advance for ur help.
yasso
-
I am using a textbox to insert time into a databse table "SQL Server", The column data type in the table is datetime. When i insert it an run the page i see the date 1/1/1900 in the GridView but i don't want it to appear. What should i do to solve this problem. Thanx in advance for ur help.
yasso
you have to check the date before displaying on the page, you can do it in sql statement or on rowdatabound, in sql, you can do, case when datefield='1/1/1900' then '' else convert(varchar, datefield, 101) end as datefield in rowdatabound if(row.Cells[datefieldindex].Text=='1/1/1900') row.Cells[datefieldindex].Text = string.Empty;
-----
-
you have to check the date before displaying on the page, you can do it in sql statement or on rowdatabound, in sql, you can do, case when datefield='1/1/1900' then '' else convert(varchar, datefield, 101) end as datefield in rowdatabound if(row.Cells[datefieldindex].Text=='1/1/1900') row.Cells[datefieldindex].Text = string.Empty;
-----
Thx for ur help but i didn't know how to solve it :sigh:, i am a new developer and i have a little experience. Lets say i want to use the rowdatabound, but what is that a property of the Gridview?? I am using a GridView to display the data and one of its columns displayes the time "with the date that i don't want it to appear". where should i put the code that u sent???? Thanx for ur help
yasso
-
I am using a textbox to insert time into a databse table "SQL Server", The column data type in the table is datetime. When i insert it an run the page i see the date 1/1/1900 in the GridView but i don't want it to appear. What should i do to solve this problem. Thanx in advance for ur help.
yasso
Hi, insted of using text box for date user date picker control http://www.basicdatepicker.com/ thanks
-
Hi, insted of using text box for date user date picker control http://www.basicdatepicker.com/ thanks
Thanx Naif i downloaded it and i am using it on the pages but i am using the insert query in the sqldatasource to write to database, all the other controls in the page appear in the controlID: except the timepicker, how can i use it to write data to database?? Thanx for ur help
yasso
-
Thx for ur help but i didn't know how to solve it :sigh:, i am a new developer and i have a little experience. Lets say i want to use the rowdatabound, but what is that a property of the Gridview?? I am using a GridView to display the data and one of its columns displayes the time "with the date that i don't want it to appear". where should i put the code that u sent???? Thanx for ur help
yasso
well the following code should be used in your SQL STATEMENT or stored procedure whateevr you are using case when datefield='1/1/1900' then '' else convert(varchar, datefield, 101) end as datefield or use OnRowDataBound="gv_RowDataBound" in html where you insert the gridview control and int he code behind create a sub protected virtual void gv_RowDataBound(object source, gridviewroweventargs e) and use this in this sub if(row.Cells[datefieldindex].Text=='1/1/1900') row.Cells[datefieldindex].Text = string.Empty; look at this [^] for gridview
-----