Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SelectedIndexChanged non changing?
Message
De
21/03/2003 12:34:08
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00768265
Message ID:
00768679
Vues:
23
Stephen,

Couldn't you have used the pi_applpg column as your DataValueField in the DropDown? Then you wouldn't need to be jumping through all those hoops to get at it (it would stored in MyDropDown.SelectedValue). Unless you're storing the key in that property for some other reason, that is. If not, it makes more sense to do it the way I suggested.

~~Bonnie


>Bonnie, It took a long time to realize that my Index column was not unique. That was teh gag to the whole thing working!
>
>Anyway, after I added the REAL key to the dataset my "changed" event was firing. Now for the ulgy part.
>
>Gettign the value from that list for col 3, the data that you need to reference goes like this:
>int lco= (MmDropDownList2.SelectedIndex);
>//Response.Write(lco);
>Models oModels = (Models)this.RegisterBizObj(new Models());
>DataSet dsGetModels = oModels.GetModels(MmDropDownList1.SelectedItem.Text);
>string aPage = (dsGetModels.Tables["depindx"].Rows[lco]["pi_applpg"].ToString());
>
>I needed that aPage value to pass to another page. The more I code in C# the more I love VFP!
>
>__Stephen
>
>>Stephen,
>>
>>I'm struggling right now with coming up with a base class for DropDown lists (which supposedly work the same as the list box). So far, I've found that in the PageLoad (on a post-back), the value that the user chose (this.MyDropDown.SelectedValue) is correct, but you have to be careful what you do with it at that point. IOW, you're probably "overwriting" that SelectedValue in some other place during a post-back. I can't be anymore specific because as I said, I'm still trying to come up with where is the best place to set the DataSource and do both types of DataBinding (complex and simple). I would have thought that Kevin's base classes would handle this already (and they probably do).
>>
>>Anyway, my reply doesn't help you solve your problem, but it might give you some insight as to what may be happening. If *I* suddenly get some insight on this, I'll let you know. >>
>>~~Bonnie
>>
>>>I fill a list box (Mere Morals) this way:
>>>
>>>Models oModels = (Models)this.RegisterBizObj(new Models());
>>>// Get a DataSet containing all makes
>>>DataSet dsGetModels = oModels.GetModels(MmDropDownList1.SelectedItem.Text);
>>>// Persist the DataSet to the Session object
>>>Session["dsGetModels"] = dsGetModels;
>>>
>>>MmDropDownList2.DataSource = dsGetModels;
>>>MmDropDownList2.DataTextField = "pi_model";
>>>MmDropDownList2.DataValueField = "pi_applpg";
>>>MmDropDownList2.DataBind() ;
>>>
>>>I have unique displayed Models pi_model, and redundant Pages pi_applpg. (This is a printed catalog). Many different models will show on the same page.
>>>
>>>When I fill the list box, and move to a new record SOMETIMES the SelectedIndexChanged doesn't fire, other times it does. More research shows that the "page" is the same. If I see data in the list as 1,2,3,....15. #1 is initially selected. User will pick #3, but #1 stays in the control. Why? Is it the DataValue is the same? (same page ?)
>>>
>>>__Stephen
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform