Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-13-2005, 10:30 AM   PM User | #1
frmsasp
New to the CF scene

 
Join Date: Sep 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
frmsasp is an unknown quantity at this point
Date/Time format & multiple selection with listbox problem in ASP.net & C#

Hello there,

Currently I am working with the project which needs time format in 24 hours format(in ASP.net & C# langauges) and other features but i am facing problem with them. I have described the problems below in detail to easily understand, so please let me know if you know...

1> How to convert 10:30 pm into 22:30(24 hrs time format)?

2> I had used listbox with multiple selection for display of my item. Following is a example.
1. Item One.
2. Item Two.
3. Item Three.
4. Item Four.
5. Item Five.
Now at the time of record insertion I had select Item Two, Item Four, Item Five. In database I will store its ID with comma delimiter says 2,4,5.
Now in the edit form I want to display selectionbar on old previous item in listbox. so how shall I ?
I had used below code:
for (j=0; j < IdSplit.Length; j++)
{
LstBox.SelectedValue = IdSplit[j].ToString();
}
This will shows selectionbar on last id only. In our example it will shows selectionbar on Item Five, 5.

3> I had created checkbox dynamically with below statement FOR EACH Module.
lblCheck.Text += "<input type='checkbox' name='chk[" + daDetail["Module_id"] + i.ToString() + "]' value='A'>Add
lblCheck.Text += "<input type='checkbox' name='chk[" + daDetail["Module_id"] + i.ToString() + "]' value='E'>Edit
lblCheck.Text += "<input type='checkbox' name='chk[" + daDetail["Module_id"] + i.ToString() + "]' value='D'>Delete
lblCheck.Text += "<input type='checkbox' name='chk[" + daDetail["Module_id"] + i.ToString() + "]' value='S'>
Search Say my Module_Id = 12
After form submit, I got value by form.querystring["chk121"]; form.querystring["chk122"];
form.querystring["chk123"];
form.querystring["chk124"];
but I want to use foreach loop for checking of for loop. Because there are more then 50 modules. so how shall I do this ?

Any help, advice or pointers on this matter would be highly appreciated.

Thanks,
Paresh
frmsasp is offline   Reply With Quote
Old 10-26-2005, 11:34 PM   PM User | #2
kampfer
New Coder

 
Join Date: Oct 2005
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
kampfer is an unknown quantity at this point
1. Solution:

DateTime dt = DateTime.Now;
Console.WriteLine( "{0:t}", dt.ToUniversalTime( ) );

2. Solution:
You need to use the ListBox Add method to add a new ListItem

for ( j=0; j < IdSplit.Length; j++ )
{
LstBox.Items.Add( new ListItem( IdSplit[j] );
}

hope those help

-john
kampfer is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:37 PM.


Advertisement
Log in to turn off these ads.