here is my sample(i modified the previous source code it self)
database updates
alter table testtable1 add gender char(1)( u need to update the gender values in the testtable1)
create table testtable2 values (id int, subject varchar(10))
insert into testtable2 values (1,'A')
insert into testtable2 values (1,'B')
insert into testtable2 values (1,'C')
insert into testtable2 values (1,'D')
insert into testtable2 values (1,'E')
insert into testtable2 values (1,'F')
insert into testtable2 values (1,'G')
insert into testtable2 values (1,'H')
insert into testtable2 values (2,'A')
insert into testtable2 values (2,'B')
insert into testtable2 values (2,'C')
insert into testtable2 values (3,'D')
insert into testtable2 values (3,'E')
insert into testtable2 values (3,'F')
insert into testtable2 values (4,'G')
insert into testtable2 values (4,'H')
insert into testtable2 values (4,'A')
insert into testtable2 values (4,'B')
insert into testtable2 values (5,'C')
insert into testtable2 values (5,'D')
insert into testtable2 values (5,'E')
insert into testtable2 values (6,'F')
insert into testtable2 values (6,'G')
insert into testtable2 values (6,'H')
dhanabalanr
Participant
978 Points
181 Posts
Re: filling the textbox,dropdownlist from the database??
Jan 24, 2008 12:56 PM|LINK
Hi Jack,
"SELECT ID DISPMEM, ID VALMEM FROM TESTTABLE1"
dispmem is DataTextField for ddl and valmem is DataValueField for ddl
for your second question answer is yes. In that way only i've populated the ddl
copy my sample code and run it in a test page.
HTH
Dhana
Dont forget to mark as answer if my reply helped you...
jack007
Member
165 Points
588 Posts
Re: filling the textbox,dropdownlist from the database??
Jan 25, 2008 04:24 AM|LINK
hi vinz,
sorry it did not work.i copied the code and paste it.but it prompts me with the same error msg.
i also tried by removing this line of code : conn.Open();
but it shows another error message saying : invalid object name 'addressbook'.
here addressbook is the name of the table in my database.
any clue..
thanks.
jack007
Member
165 Points
588 Posts
Re: filling the textbox,dropdownlist from the database??
Jan 25, 2008 04:34 AM|LINK
hi dhana..
thanks for the answer..
but my 2nd question was not that.
what i meant was , in the example u showed me, there u could select a option from
the dropdownlist and get ur textboxes automatically populated by the data in the database.there's no problem till here.
but my question is,
similarly, can i select a option in the dropdownlist and populate listbox, another dropdownlist , radio button , checkbox instead of textbox?
thanks..
dhanabalanr
Participant
978 Points
181 Posts
Re: filling the textbox,dropdownlist from the database??
Jan 25, 2008 06:28 AM|LINK
HI Jack,
Yes we can do that also
here is my sample(i modified the previous source code it self)
database updates
HTHDhana
Dont forget to mark as answer if my reply helped you...
jack007
Member
165 Points
588 Posts
Re: filling the textbox,dropdownlist from the database??
Jan 25, 2008 09:29 AM|LINK
Hi Dhana..
Thank you very much for the code.
See the code u gave me works very fine when ever i copy-paste and run it.
but whenever i try to include it in my existing project in doesnot work.
since i m very new to ajax, i could have made mistake.
anyway, let me tell u my project scenario more clearly ok.
See i have a web form.In that i have used Asp.net Ajax cascading drop down list.
so when ever i choose a option from the first dropdownlist the related data gets automatically populated in
the second drop down list..Its completely working till here..
now my problem is when ever i choose a option from the second dropdownlist i want the related data to that option to be
filled in rest of the textboxes ,listbox, radiobuttons etc in my web form..hope u r getting my point.
my cascading dropdownlist is working fine.only when i choose a option from second dropdownlist the related data(from database) is not showing in rest
of the controls at all.
and i am not using database to populate my dropdownlist.(i m using xml file)
well can anything be done to accomplish this.?
Thanks..
Jack.
dhanabalanr
Participant
978 Points
181 Posts
Re: filling the textbox,dropdownlist from the database??
Jan 25, 2008 10:42 AM|LINK
Hi Jack,
How do you populate the both DDL? Both using XML?
Didnt you using DataBase?
can you give me a sample xml?
Dhana
Dont forget to mark as answer if my reply helped you...
jack007
Member
165 Points
588 Posts
Re: filling the textbox,dropdownlist from the database??
Jan 27, 2008 04:47 AM|LINK
Hi Dhana.
If you want to see how this works..then check the following link.
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/CascadingDropDown/CascadingDropDown.aspx
and if you want to get the full source code and xml file u can get using this link.
http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=8513
well i didn't do it by myself. i just downloaded the code from the above site and made little bit
modification..i hope u could play around with it too.
ok dhana..lets have another scenario here.(like u said)
lets say i use my sqldatabase to populate both the dropdownlist.then after selecting the the option from the second dropdownlist i get a required
textboxes,listboxes filled automatically from the database.lets say option for the first dropdownlist comes from 1st table and the option for
the 2nd dropdownlist and the remaining data to be populated in the textboxes comes the 2nd table.
well i dont know idea to do this..any tips on how can i accomplish this?
thanks.
Jack..
dhanabalanr
Participant
978 Points
181 Posts
Re: filling the textbox,dropdownlist from the database??
Jan 28, 2008 10:04 AM|LINK
Ok Jack,
here is the sample code as you want
DataBase Queries
aspx page
CS file
HTH. Let me know the results
Dhana
Dont forget to mark as answer if my reply helped you...
jack007
Member
165 Points
588 Posts
Re: filling the textbox,dropdownlist from the database??
Jan 28, 2008 11:17 AM|LINK
Hello Dhana,
First of all Thanks a lot for clarifying the concept with such an easy
example.
Well i was going too deep.But the solution u gave seems very appropriate and short.
Anyway i need to first import this code in my project and see how it works.
If there is any problem i ll surely inform you.
Anyway thankyou very much.
jack..
dhanabalanr
Participant
978 Points
181 Posts
Re: filling the textbox,dropdownlist from the database??
Jan 28, 2008 03:41 PM|LINK
Hi Jack,
Thanks. Let me know the results
Dhana
Dont forget to mark as answer if my reply helped you...