


If Event is a single day event, I have to input values into DateFrom and TimeFrom columns only. Also, the date and time for the other day will display too**(but they will be values that I did not input in the fields).** Which is why I asked if there be a way that I could the labels that show date and time for when the event will end So, if I registered an event for one day, the date and time will be displayed. I asked myself, what if the event was a one day event, how will I display data on the details page?įrom what I have, after an event registration, I get redirected to another page where the details are displayed. Now when it gets to a page where user can view details of the different events which the user had registered, the dates and time will also show. So, I want a situation where a user can register an event and if the event is more than one day, the user can insert other days in the provided fields and save the data. Here is the thing, There are events that last for more than a day some can take 3 days. Let me try to explain if you'll understand what I mean. If (longdate != null & longtime != null)ĭash.Visible = false //I also try to hide the labels that are used "To" value String longtime = dr.ToString().ToString() String longdate = dr.ToString().ToString() This is how I tried to hide the labels of DateTo and TimeTo if the event is a One-day event Timeto.Text = DateTime.Parse(dr = DBNull.Value ? (string)null : Convert.ToDateTime(dr).ToString()).ToString("hh:mm tt") Timefrom.Text = DateTime.Parse(dr = DBNull.Value ? (string)null : Convert.ToDateTime(dr).ToString()).ToString("hh:mm tt") ĭateto.Text = DateTime.Parse(dr = DBNull.Value ? (string)null : Convert.ToDateTime(dr).ToString()).ToString("MMM d, yyyy") Using (SqlCommand cmd = new SqlCommand("SELECT * FROM TblEvnt WHERE eventName AND Id Session) ĭatefrom.Text = DateTime.Parse(dr = DBNull.Value ? (string)null : Convert.ToDateTime(dr).ToString()).ToString("MMM d, yyyy") Using (SqlConnection con = new SqlConnection(connectionString)) Protected void Page_Load(object sender, EventArgs e) Then if the event has another Date and Time, it should show the DateTo and TimeTo labels It should only show DateFrom and TimeFrom. If the user did not insert into those columns (i.e., the event is a one-day event). I just want to hide the labels that show DateTo and TimeTo if the values are default values. User 1 did not insert input any data into DateTo and TimeTo columns Id some dates and time were inserted by default, because the textboxes were left empty when the data inserted. In this below table, the user with ID = 1 did not insert DateTo and TimeTo values. Now for one day seminar, when user inserts data into table, leaving the DateTo and TimeTo textboxes empty, regardless of these data will be still be inserted by default into those columns because I set the DataType of each date and time columns to datetime in the table. But if the seminar will be for 3 days, then the user will input value into DateTo and TimeTo Texboxes. If the seminar will be only for one day, then the user will not input any value into DateTo and TimeTo Textboxes the DateTo and TimeTo Textboxes will be empty. For instance, when a user registers a seminar, the user inserts the date and Time from when the seminar will start and end. The process is okay and Data is inserted into the table.īut where I have issue is that I can’t hide some labels that have DateTo and TimeTo values when their values are default. Then in my Table, I set the Data Type for each Date and Time data to “datetime”. The date Textboxes have their TextMode set to “date” and the Textboxes for time set to “Time”. Four of the Textboxes are to input Dates and Times.Įxample, 1.DateFrom – 2. I have a form with TextBoxes where user inserts their values into database. How do I hide labels that display unwanted values if I don’t want to?
