how to display data in a gridview?
-
Hi I have 2 tables in database as follows: table1: id name state id 1 aaa 1,2 2 bbb 1,3 table2: id state 1 ak 2 ny 3 jk so the problem is that I want to display all the data of "table1" in a gridview and in place of "state id" I want to display "statename", for example in place of "1,2" I want to display "ak,ny". How to do this? Please help me:confused:. Thanks
-
Hi I have 2 tables in database as follows: table1: id name state id 1 aaa 1,2 2 bbb 1,3 table2: id state 1 ak 2 ny 3 jk so the problem is that I want to display all the data of "table1" in a gridview and in place of "state id" I want to display "statename", for example in place of "1,2" I want to display "ak,ny". How to do this? Please help me:confused:. Thanks
Are you asking for help with building an SQL statement? If so, it might look like this: Select t1.*, t2.State as StateAcro from table1 as t1 inner join table2 as t2 on (t1.id=t2.id) Otherwise, could you elaborate a bit more?
-
Are you asking for help with building an SQL statement? If so, it might look like this: Select t1.*, t2.State as StateAcro from table1 as t1 inner join table2 as t2 on (t1.id=t2.id) Otherwise, could you elaborate a bit more?
-
Hi I have 2 tables in database as follows: table1: id name state id 1 aaa 1,2 2 bbb 1,3 table2: id state 1 ak 2 ny 3 jk so the problem is that I want to display all the data of "table1" in a gridview and in place of "state id" I want to display "statename", for example in place of "1,2" I want to display "ak,ny". How to do this? Please help me:confused:. Thanks
Seems to me like you need to design your db better in future ( a joining table would have made this doable in the SQL ). You can read your array of state names and Ids, then write a data binding statement that passes the id string to the code behind, where you use the split method and a string builder to build a string that contains the state abbreviations.
Christian Graus Please read this if you don't understand the answer I've given you "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 )
-
Seems to me like you need to design your db better in future ( a joining table would have made this doable in the SQL ). You can read your array of state names and Ids, then write a data binding statement that passes the id string to the code behind, where you use the split method and a string builder to build a string that contains the state abbreviations.
Christian Graus Please read this if you don't understand the answer I've given you "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 )
Hi Christian Thanks for reply Actually I am displaying names of states in a checkbox list and after submitting the form, storing selected checkbox stateids in database with stateids seperated by comma as in table1. If you have any working example or else any suggestion, please send it. Thanks
-
Hi Christian Thanks for reply Actually I am displaying names of states in a checkbox list and after submitting the form, storing selected checkbox stateids in database with stateids seperated by comma as in table1. If you have any working example or else any suggestion, please send it. Thanks
What I said. A joining table joins data where there's an arbitrary number of joins id name state id 1 aaa 1,2 2 bbb 1,3 table2: id state 1 ak 2 ny 3 jk table3: nameId, stateId 1, 1 1, 2 2, 1 2, 3 then table 1 loses the stateID column.
Christian Graus Please read this if you don't understand the answer I've given you "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 )