javascripting with web controls
-
it works fine if i use dropdownlist, but in dropdownlist you will insert the data in the database individually right?. I want to use listbox for me to insert all the data in a single click of the button. God Bless you! Bernie Leynes
HI, I am not getting you exact requirement. Can you pelase elaborate by giving an example? Thanks and Regards, Chetan Ranpariya
-
HI, I am not getting you exact requirement. Can you pelase elaborate by giving an example? Thanks and Regards, Chetan Ranpariya
ok. heres my example I have 2 dropdown and a listbox and a table in my database drpcategory drpNames listbox1 table1- the columns are Category,Name I have items in drpcategory. the items are: Agent, Trainees In my drpNames the items are : Bernie, Ray, Kirby listbox1.items= drpNames.selecteditem.text If my listbox1 contains all the names from drpNames and i select "Agent" from drpCategory then i click insert button all the 3 names on my listbox will be inserted but different row. The result will be Category Name Agent Bernie Agent Ray Agent Kirby My problem is even if i have multiple items in my listbox then after i click insert int only insert 1 row in my table which is the first row only Bernie Leynes
-
ok. heres my example I have 2 dropdown and a listbox and a table in my database drpcategory drpNames listbox1 table1- the columns are Category,Name I have items in drpcategory. the items are: Agent, Trainees In my drpNames the items are : Bernie, Ray, Kirby listbox1.items= drpNames.selecteditem.text If my listbox1 contains all the names from drpNames and i select "Agent" from drpCategory then i click insert button all the 3 names on my listbox will be inserted but different row. The result will be Category Name Agent Bernie Agent Ray Agent Kirby My problem is even if i have multiple items in my listbox then after i click insert int only insert 1 row in my table which is the first row only Bernie Leynes
hi, See in this case the solution is what I have told you before. U have to loop through all the items in the listbox and create INSERT query for each of the item and execute it. Can u send the code you have written?
Thanks and Regards, Chetan Ranpariya
-
hi, See in this case the solution is what I have told you before. U have to loop through all the items in the listbox and create INSERT query for each of the item and execute it. Can u send the code you have written?
Thanks and Regards, Chetan Ranpariya
listbox1.items = drpNames.selecteditem.text this is how i get the items from dropdown and display in listbox. How can i Loop all the items from listbox? If i do looping it will insert all the items from listbox in my table in the database? Bernie Leynes
-
listbox1.items = drpNames.selecteditem.text this is how i get the items from dropdown and display in listbox. How can i Loop all the items from listbox? If i do looping it will insert all the items from listbox in my table in the database? Bernie Leynes
Hi, The onel line of code u have given will not execute coz it will give compile time error. yes i u loop through all items in the listbox it will all the items from the listbox in the table in database. how do u try to insert data in the table in you database? Please paste your code here. Thanks and Regards, Chetan Ranpariya
-
Hi, The onel line of code u have given will not execute coz it will give compile time error. yes i u loop through all items in the listbox it will all the items from the listbox in the table in database. how do u try to insert data in the table in you database? Please paste your code here. Thanks and Regards, Chetan Ranpariya
Heres my code.. INSERT INTO table1(category,Name)VALUES(@category,@name) category bind to drpcategory name bind to listbox1 You are blessed men. Thanks Bernie Leynes
-
Hi, The onel line of code u have given will not execute coz it will give compile time error. yes i u loop through all items in the listbox it will all the items from the listbox in the table in database. how do u try to insert data in the table in you database? Please paste your code here. Thanks and Regards, Chetan Ranpariya
I know you know how to do that man. Please help me.. Thanks and God Bless Bernie
-
I know you know how to do that man. Please help me.. Thanks and God Bless Bernie
HI, I have asked you to paste your whole code here. but I dont think you want to do that. You are just pasting one or two lines and want me to do everything for you. Things doesnt happen like that. If you want to insert values from the listbox the commong logic is that you take items from the listbox one by one and create insert query for each of the item and execute the query. foreach(ListItem LI in lstbox.Items) { string strquery = "Insert Into table Values ('" + ddl.SelectedValue + "', '" + LI.Value + "')"; cmd.executenonquery(strquery); } THis is the commong logic. You implement this as per your requirement. If any further assistance is needed then do reply with the whole code u have written to insert the data in the table. Thanks and Regards, Chetan Ranpariya
-
HI, I have asked you to paste your whole code here. but I dont think you want to do that. You are just pasting one or two lines and want me to do everything for you. Things doesnt happen like that. If you want to insert values from the listbox the commong logic is that you take items from the listbox one by one and create insert query for each of the item and execute the query. foreach(ListItem LI in lstbox.Items) { string strquery = "Insert Into table Values ('" + ddl.SelectedValue + "', '" + LI.Value + "')"; cmd.executenonquery(strquery); } THis is the commong logic. You implement this as per your requirement. If any further assistance is needed then do reply with the whole code u have written to insert the data in the table. Thanks and Regards, Chetan Ranpariya
im sori but i am using SQLDataSource thats why i have only one line of Code. I just bind the listbox on my textfield. I did not use the manual connection in code behind. Any idea about that?. I already check the multiple selection but still insert 1 data per transaction thank you Bernie
-
HI, I have asked you to paste your whole code here. but I dont think you want to do that. You are just pasting one or two lines and want me to do everything for you. Things doesnt happen like that. If you want to insert values from the listbox the commong logic is that you take items from the listbox one by one and create insert query for each of the item and execute the query. foreach(ListItem LI in lstbox.Items) { string strquery = "Insert Into table Values ('" + ddl.SelectedValue + "', '" + LI.Value + "')"; cmd.executenonquery(strquery); } THis is the commong logic. You implement this as per your requirement. If any further assistance is needed then do reply with the whole code u have written to insert the data in the table. Thanks and Regards, Chetan Ranpariya
hi again, do you have any idea on how to create exam application in asp.net 2.0 web app? Bernie