|
As others have pointed out, you have no way to store only the date part in date time field. You have to store only datetime or store the date in a string field. Doing the later would hinder you if you wish to do data manipulation based on the date value.
Now if you try to store only the date in a datetime column, the db by default would add 00 hrs as the default time value [correct me if I'm wrong].
Now you can easily remove the time part in the query using CONVERT(VARCHAR,[date column],101) . But doing so would put extra load on your query and reduce its performance.
The best way to deal with it is to get the datetime value to the application and apply formatters to remove the time part from the datetime value. All that you need to do is to set the format string for the control that is going to display the value and you would be done.
HTH!
|
|
|
|
|
hi....thanks for your reply
i've used all those functions to retrieve date from the field...but i just thought that if we would be able to save date only then how cool it would be.....anyways thanks for your reply
|
|
|
|
|
Hi..
I creatd some dynamic textboxes in repeater control.. Had a button to add textboxes.. and link button to delete the rows from db..
im deleting the rows from repeater based on id in the table...upto this its working fine. But when i click on add button to add more rows and if i want to delete those rows, as they dont have any id in table how do i delete those rows..
|
|
|
|
|
where you are keeping the newly added object?or in other words do u have any persisting DataSource object for repeater?
|
|
|
|
|
the values in the added text boxes if required they are inserted into db.. But before inserting if i need to delete them how can i...
|
|
|
|
|
test-09 wrote: the values in the added text boxes if required they are inserted into db.. But before inserting if i need to delete them how can i...
when clicking new row button how you are adding rows to repeater?Do u have any persisting object in code behind?Have tried deleting by index of the repeater item?
|
|
|
|
|
 this is how im adding new row...
private void adddescription()
{
int rowIndex = 0;
if (ViewState["CurrentTable"] != null)
{
dtDesc = (DataTable)ViewState["CurrentTable"];
DataRow drCurrentRow = dtDesc.NewRow();
if (dtDesc.Rows.Count > 0)
{
for (int i = 1; i <= dtDesc.Rows.Count; i++)
{
TextBox box1 = (TextBox)Rptdescription.Items[rowIndex].FindControl("TextName");
TextBox box2 = (TextBox)Rptdescription.Items[rowIndex].FindControl("TextDate");
TextBox box3 = (TextBox)Rptdescription.Items[rowIndex].FindControl("TextDescript");
drCurrentRow = dtDesc.NewRow();
drCurrentRow["RowNumber"] = i ;
ViewState["RowNumber"] = drCurrentRow["RowNumber"];
Label1.Text = ViewState["RowNumber"].ToString();
dtDesc.Rows[i - 1]["DescriptionName"] = box1.Text;
dtDesc.Rows[i - 1]["Date"] = box2.Text;
dtDesc.Rows[i - 1]["Description"] = box3.Text;
rowIndex++;
}
dtDesc.Rows.Add(drCurrentRow);
}
else
{
dtDesc = (DataTable)ViewState["CurrentTable"];
DataRow descRow = dtDesc.NewRow();
descRow["DescriptionName"] = "";
descRow["Date"] = "";
descRow["Description"] = "";
dtDesc.Rows.Add(descRow);
}
}
Bindrepeater();
}
|
|
|
|
|
Okay.Delete button is in the repater.right?then in the delete button click event you'll get the item index and using that item index delete that object from the viewstate and rebind repeater.is that makes sense?
|
|
|
|
|
im losing the values in textboxs on postback.... i cant check which row im deleting correctly as the values go on postback...
int iddelete;
iddelete = ToInt(e.CommandArgument.ToString());
if (iddelete!=0)
{
}
else
{
int count = e.Item.ItemIndex;
dtdelete.Rows[count].Delete();
dtdelete.AcceptChanges();
Rptdescription.DataSource = dtdelete;
Rptdescription.DataBind();
}
|
|
|
|
|
test-09 wrote: im losing the values in textboxs on postback...
Which values you are loosing?ItemIndex is enough to delete it from ViewState?Is this code working?whats the difficulty you are facing in the above code?
If you are saying about entered values in textboxes, then save that values to the persisting object before rebinding the repeater.
|
|
|
|
|
the last row is deleting if i click on delete of any row... what may be problem
|
|
|
|
|
You might have 'hard coded' index of last row. Please check that. This could be the case.
Thanks,
Arindam D Tewary
|
|
|
|
|
i'm new to asp.net...i don know all its technicalities.....i want to create a seat chart of some auditorium using javascript and enable and disable some of its seats....also allow user to select some of the seats without page reload(only the color of those seats may get changed....and i may be able to collect their seat numbers)
if anyone can help me with this or can tell me some other way to create such a user interactive seat chart...???
|
|
|
|
|
Its better to use update panel other than Java script for seat chart
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
hi....if you can please elaborate how can i use the update panel for the seat chart of a cinema hall as i'm not through with all the technicalities of asp.net....as i'm still studying it.
modified on Wednesday, March 31, 2010 12:27 PM
|
|
|
|
|
First how You are trying to display the number of seats. are you trying to use the buttons or any control.
I suggest you the update panel because it will not refresh the whole page .
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
hi all....
i'm using html input button for this purpose....but i'm unable to retrieve the values in .cs file....what i want is to display arrangement of around 100 seats in a theatre...and would like user to select some seats whose color will change on clicking without reloading the page.....and in .cs file i may be able to retrieve the seat numbers...???
same seat chart as you would find one while booking tickets for a movie online....they ask you select seats of your choice....i wanna do the same thing....can anyone help me???
|
|
|
|
|
hi sashidhar.....
i tried to use the update panel.....i took an update panel.....and 5 buttons....took a session variable and incremented it on click event of each button.....it all worked but the problem now is if i refresh the page the value of session variable is not refreshed....counting starts from the last where the page was refreshed....i'm providing you the code....Have a look....!!!
The default.aspx File:
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />
<asp:Button ID="Button6" runat="server" onclick="Button6_Click" Text="cancel" />
<br />
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<br />
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Panel Created"></asp:Label>
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" BackColor="Aqua"
onclick="Button1_Click" Text="Button" />
<br />
<br />
<asp:Button ID="Button2" runat="server" BackColor="Aqua"
onclick="Button2_Click" Text="Button" />
<br />
<br />
<asp:Button ID="Button3" runat="server" BackColor="Aqua"
onclick="Button3_Click" Text="Button" />
<br />
<br />
<asp:Button ID="Button4" runat="server" BackColor="Aqua"
onclick="Button4_Click" Text="Button" />
<br />
<br />
<asp:Button ID="Button5" runat="server" BackColor="Aqua"
onclick="Button5_Click" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
now the Default.aspx.cs File:
The code was given on click event of all buttons taken in update panel:
int i = Convert.ToInt32(Session["i"]);
i++;
Session["i"] = i.ToString();
Button3.BackColor = System.Drawing.Color.Red;
Label1.Text = "Refreshed at " + DateTime.Now.ToString();
Button3.Enabled = false;
|
|
|
|
|
please tell me how can i refresh the value of session variable on page refresh
|
|
|
|
|
Will there be any problem for image to display in runtime? If IIS is not installed in our system?
Every time in run time the image in not viewable but while at design time it is viewable.
|
|
|
|
|
1. Displaying images does not depens upon IIS. If you dont have IIS then you can not host an .NET web application.
2. It seems that you can run the application and in runtime you can not see images. FYI, you mention images path in controls of your application and at runtime, the images path should match to the actual physical location images.
if you dont see images, rather you get to see 'image' control but a 'cross' showing images not displayed, right click on images to get to see what path the control is expecting at runtime. Depending upon that you should modify the image path in design view.
Please let me know if you get it going.
Thanks,
Arindam D Tewary
|
|
|
|
|
In each system it wil be prefixed with Local host number. the same code is working in other system. then what would be the problem? On ur suggestion i had right clicked on the image this was the link http://localhost:49216/ws/App_Data/pics/pic1.jpg in this except local host and its number my path is same
asp:TableCell ID="TableCell4" ColumnSpan ="2" VerticalAlign = "Top" HorizontalAlign ="Center" runat ="server">
<asp:image id="Image1" runat="server" imageurl="../../../../../App_Data/pics/pic1.jpg">
|
|
|
|
|
thanks fr d info will try it out and let you no
|
|
|
|
|
i want to compare the value of two text boxes and on true/false condition i want to display the message in a dialog box.....can any one help me with the coding in javascript????
|
|
|
|
|
if(document.GetElementById("txt1").value == document.GetElementById("txt1").value)
{
alert("Some message");
}
else
{
alert("Some message");
}
What's so difficult?
I know the language. I've read a book. - _Madmatt
|
|
|
|