bind data in ASP.NET
-
Hello, I get a problem in my project when binding data from the DataSource. Here is it: Well, i have 2 tables as below: Categories: ============== CategoryID CategoryName Products: ============== ProductID CategoryID ProductName That is, now i would like to bind data so that i get the HTML Source like this: <
select name="Product"> NameOfFirstCategory NameOfFirstProductInTheFirstCategory NameOfSecondProductInTheFirstCategory NameOfSecondCategory NameOfFirstProductInSecondCategory NameOfSecondProductInSecondCategory
my question is that is there available control that can do that or what ASP.NET server control should i use ? and ... plz show me a code example of it. thanks a lot !!! -
Hello, I get a problem in my project when binding data from the DataSource. Here is it: Well, i have 2 tables as below: Categories: ============== CategoryID CategoryName Products: ============== ProductID CategoryID ProductName That is, now i would like to bind data so that i get the HTML Source like this: <
select name="Product"> NameOfFirstCategory NameOfFirstProductInTheFirstCategory NameOfSecondProductInTheFirstCategory NameOfSecondCategory NameOfFirstProductInSecondCategory NameOfSecondProductInSecondCategory
my question is that is there available control that can do that or what ASP.NET server control should i use ? and ... plz show me a code example of it. thanks a lot !!!drpList.DataSource = ds drpList.DataTextField = "FIELD1" drpList.DataValueField = "FIELD2"
where, ds - is the dataset containing the desired data drpList - ID for the 'SELECT' list FIELD1, FIELD2 - name of the field of the table He who controls others may be powerful,
But he who has mastered himself is mightier still. -
drpList.DataSource = ds drpList.DataTextField = "FIELD1" drpList.DataValueField = "FIELD2"
where, ds - is the dataset containing the desired data drpList - ID for the 'SELECT' list FIELD1, FIELD2 - name of the field of the table He who controls others may be powerful,
But he who has mastered himself is mightier still.thansk for you answer but i think you read my question carelessly. That does not solve my problem and not that i got
-
Hello, I get a problem in my project when binding data from the DataSource. Here is it: Well, i have 2 tables as below: Categories: ============== CategoryID CategoryName Products: ============== ProductID CategoryID ProductName That is, now i would like to bind data so that i get the HTML Source like this: <
select name="Product"> NameOfFirstCategory NameOfFirstProductInTheFirstCategory NameOfSecondProductInTheFirstCategory NameOfSecondCategory NameOfFirstProductInSecondCategory NameOfSecondProductInSecondCategory
my question is that is there available control that can do that or what ASP.NET server control should i use ? and ... plz show me a code example of it. thanks a lot !!!MrMicrosoftvn wrote: my question is that is there available control that can do that or what ASP.NET server control should i use ? and ... plz show me a code example of it. Please explai me what you want!!! He who controls others may be powerful,
But he who has mastered himself is mightier still. -
Hello, I get a problem in my project when binding data from the DataSource. Here is it: Well, i have 2 tables as below: Categories: ============== CategoryID CategoryName Products: ============== ProductID CategoryID ProductName That is, now i would like to bind data so that i get the HTML Source like this: <
select name="Product"> NameOfFirstCategory NameOfFirstProductInTheFirstCategory NameOfSecondProductInTheFirstCategory NameOfSecondCategory NameOfFirstProductInSecondCategory NameOfSecondProductInSecondCategory
my question is that is there available control that can do that or what ASP.NET server control should i use ? and ... plz show me a code example of it. thanks a lot !!! -
Yes.I know what do you want. I think you can't use "DataBind" directly.Here you will use "Item.Add" add your DropDownList items.In your CodeBehind file you will do this.And this will get to your points. Want this to help.Good luck!
yes, i can not use "DataBind" directly to bind my data to DropDownlist in that case. Well, i will try yr way. Thanks !!!