|
Hey there again,
I've got a List box with multi select enabled, It's got 906 items in it, and if I select the first 3 and the last 3. Then in an On_Button_Click event I scan through it only to find that 0,1,2,878,880,903 are selected when 0,1,2,903,904,905 are the ones I had selected before pressing the button.
I'm not databinding again before the On_Button_Click so I don't know what could be causing it.
Has any one seem this before?
-Ian.M
|
|
|
|
|
Are you looking at the indexes or at some sort of key value which may be correct ? I've never seen anything like this.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Ok here's the solution...
I had 906 items in the list box, if I selected 903,904,905 it would return 878,880,903. Well aparently it was a shot in the dark that I actually found this because what's actually happening is the List control says,
ok, selected items are -
"Item Name 903" , "23503"
"Item Name 904" , "32633"
"Item Name 905" , "61900"
now when you get to page load an try to see what items are selected in the list box it scans through and returns the first item that matches the Value of the ones that were selected. It doesn't actually record the indexes of the ones that were selected?!!? who knew? seriously
so i found that 878 has the same value as 903, and 880 as 904, and 903 was unique. the issue came up because I have clients that are sorted by regions, well aparently two regions has the same client so there was ClientIDa in texas and another ClientIDa in florida...
so remember folks check for duplicates, even if you think it doesn't matter.
-Ian.M
P.S: Watch out for the Evil Blue Coding Moose, it will eat you
|
|
|
|
|
If you're going to show your users 900 items, you should also alphabetise them so folks can navigate the list. Then they would have been next to each other. Or were you saying the 23503, etc were the same ? The whole point of the value is for it to be unique, so that does not surprise me.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
the 23503 is just the value, the list is sorted by another value.
text was = (clientname + " - " + divisionName)
so i sorted by division so they could quickly scroll down and find the thingy
thingy is a very technical term
|
|
|
|
|
Hi,
I've got a DropDownList that has a list of style sheets that can be used for the site. When ever the drop down changes to a new item, it should create a cookie that stores the selected style which works fine.
The problem is, when ever i set the cookie, the DropDownList.SelectedItem always thinks the first item has been selected, when it hasnt! i can never get it to select any other value, even though there are 3 different options.
Any ideas?
Regards,
Gareth.
|
|
|
|
|
gareth111 wrote: Any ideas?
You've done something wrong... Just a thought.
|
|
|
|
|
Hi Paddy,
Your right you know!, was the same error as below, not checking for IsPostBack, OPPS!
Regards,
Gareth.
|
|
|
|
|
Hi,
Im trying to get the value selected from a RadioButtonList. When ever i try to print out the SelectedValue.Item is null, as well as SelectIndex is -1. Even though i have selected an item. The below code gets the data from a database and binds it to the control.
SqlCommand command = Globals.StoredProcedures.SelectAll("Item");<br />
DataTable data = Globals.DbConnection.SelectData(command);<br />
<br />
RadioButtonListProductId.DataSource = data;<br />
RadioButtonListProductId.DataTextField = "ItemName";<br />
RadioButtonListProductId.DataValueField = "ItemId";<br />
RadioButtonListProductId.DataBind();
Even when i listen for the SelectedIndex_Changed event, nothing happens, like its not being fired. Any ideas?
Regards,
Gareth.
|
|
|
|
|
When you post the page back to check for the selected value, are you re-binding the data before you check it again?
|
|
|
|
|
Hi Paddy,
Yes i am, which is very silly of me! I knew it would be something silly that would be fixed in 2 seconds.
Regards,
Gareth.
|
|
|
|
|
Hi.I want to show the javascript alert message if the conditions fail,but the following code is not showing the alert message.when i am putting break point it is going to this code but not showing message.what is wrong in this code.
Page page = HttpContext.Current.Handler as Page;
if ((System.IO.Path.GetExtension(cmdBrowse.FileName).ToLower() != ".jpg") |
(System.IO.Path.GetExtension(cmdBrowse.FileName).ToLower() != ".bmp") |
(System.IO.Path.GetExtension(cmdBrowse.FileName).ToLower() != ".png"))
{
if (page != null)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "msgbox", "alert('Upload only jpeg or bmp or png Images');", true);
}
}
|
|
|
|
|
I see nothing wrong with the code.
Does the response result in a page so that the script has somewhere to go? Does the page have a server form? Do you run the code before the page is rendered?
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
i have two pages on two different hosts. i am trying to write something so that if someone clicks a link on my HTML only page the content of my ASP.NET (that would be an mp3 player) page will open in a non-resizable popup (not on a new tab). i am beginner so i don't even know if i will have to write something special on my HTML page or some modifications on my asp.net will suffice. i have some VB experience so i can write ASP.NET code much more easily but i have a very little knowledge about HTML. By the way by saying HTML ONLY i mean no JavaScripts! HTML ONLY indeed.
thanks in advance.
|
|
|
|
|
Use an anchor tag to specify a link in your page that opens in a new browser window, e.g.
<a href="http://www.mysite.com/"
target="_blank">Visit my site</a>
However, if you wanted to make the window non-resizable, you would need to use Javascript.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
i used flash instead of asp.net to make an mp3 player. there is a special tag on the host to add swf files to the site. now i don't need a new window. i needed one before, because the host didn't allow tag too. so i think this is the only way to include my mp3 player on that site. thanks for the answer anyway.
|
|
|
|
|
Hi, every one
I have a text box where i need to fill a name so i have given a regular expression validator for the text box so that user can fill only alphabets. The expression which i gave is [A-Z]*|[a-z]*.
when im giving all small letter it is working but if i give a capital letter follwed by small letters it is not working.
pls help me
|
|
|
|
|
sivaram praveen wrote: I have a text box where i need to fill a name so i have given a regular expression validator for the text box so that user can fill only alphabets. The expression which i gave is [A-Z]*|[a-z]*.
when im giving all small letter it is working but if i give a capital letter follwed by small letters it is not working.
The correct syntax is [A-Za-z]* to capture zero or more upper/lower case alpha characters.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanx 4 ur reply, it worked
|
|
|
|
|
Hi
I have a class which implements the singleton design pattern and is responsible for data access. The class primarily read database settings and establis a connection to a database. This class works more than 100% in my win-forms applications.
I am now starting an ASP.Net application and am wondering whether I can use the same class for my data access.
Yes it will work, but is it advisable? Will there be some problem or performance issues if I have 50 users connecting to my site?
Thank you.
Jacques Naudé
jnaude@gmail.com
|
|
|
|
|
This[^] might help you to use it in ASP.NET
|
|
|
|
|
You might be able to change it to make it work, but it's not advisable. Here are some reasons:
- A web application is a multi threaded application, so you need to make a singleton that is unique for the thread, not for the application. You can't share the same connection between threads.
- Putting the connection in a singleton makes it more complicated to close the connection properly. You don't want to keep the connection open between requests.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Guffa wrote: You might be able to change it to make it work, but it's not advisable
It depends how it is designed to work in the first place. If each method in the singleton creates its own connection and closes it by the end of the method then there aren't any problems. I typically store only the connection string so I can have as many connections running as I want.
|
|
|
|
|
Colin Angus Mackay wrote: If each method in the singleton creates its own connection and closes it by the end of the method then there aren't any problems.
In that case the singleton is pointless, and you can just make the methods static.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Guffa wrote: In that case the singleton is pointless, and you can just make the methods static.
True.
|
|
|
|