943,526 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 3087
  • ASP.NET RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Dec 10th, 2008
0

Re: Master/Detail DropDownList and DataGrid

i have two drop downlist wen i select india the partcular states shld come....but my selected index function is different from urs....is it correct
Reputation Points: 7
Solved Threads: 0
Newbie Poster
divyasrinivasan is offline Offline
21 posts
since Dec 2008
Dec 10th, 2008
0

Re: Master/Detail DropDownList and DataGrid

Is your DDL filled with each country?
Reputation Points: 26
Solved Threads: 19
Posting Whiz in Training
Traicey is offline Offline
283 posts
since Mar 2008
Dec 10th, 2008
0

Re: Master/Detail DropDownList and DataGrid

hi myrequirement is i have two dropdownlist one is country n other is statename.....wen i selelc india corresponding states shls come...but i see my selected index function is different from urs...pls explain tat...n is my code right..iam not getting the output....

one more thing how did u create the table for tat category..like i inserted 79 countries.....with id...now in state table i need to insert 28 states for india..
stateid statename countryid.....or i need to have stateid statename1........statename28 countryid
Reputation Points: 7
Solved Threads: 0
Newbie Poster
divyasrinivasan is offline Offline
21 posts
since Dec 2008
Dec 10th, 2008
0

Re: Master/Detail DropDownList and DataGrid

ya i got all the countries wic i inserted into ddllcountryname
Reputation Points: 7
Solved Threads: 0
Newbie Poster
divyasrinivasan is offline Offline
21 posts
since Dec 2008
Dec 10th, 2008
0

Re: Master/Detail DropDownList and DataGrid

I had the same problem my DDL doesnt talk to me back if I just select and do nothing, I couldnt figure out what was the problem because I had selectedChanged event but then until I had a button which I named to go and I didnt code anything on the button I just drag and dropped it so I select something from the DDL and click in the button and it worked just try that to see if its working then u will fix that problem later
Reputation Points: 26
Solved Threads: 19
Posting Whiz in Training
Traicey is offline Offline
283 posts
since Mar 2008
Dec 10th, 2008
0

Re: Master/Detail DropDownList and DataGrid

its registration form ..i cant keep button na...u find this in many site select country n corresponidng states will come in another dropdownlist...but the code iam not finding
Reputation Points: 7
Solved Threads: 0
Newbie Poster
divyasrinivasan is offline Offline
21 posts
since Dec 2008
Dec 10th, 2008
0

Re: Master/Detail DropDownList and DataGrid

U jst need to make sure that the countryID on the state table is corresponding to the one on the country name, then you can have a select stateme like this on ur dataadpater

SQL Syntax (Toggle Plain Text)
  1. SELECT * FROM State
  2. WHERE CountryID = ddlCountries.selectedValue;

Im sory I cant read your code can u edit it and make it C# instead of just text, its killing me

[ Code=C# ]
Paste code here dont leave
[ /Code ]
there souldnt be any space in between ur square brackets
Reputation Points: 26
Solved Threads: 19
Posting Whiz in Training
Traicey is offline Offline
283 posts
since Mar 2008
Dec 10th, 2008
0

Re: Master/Detail DropDownList and DataGrid

I think at the moment u can use that to debug and see whats working and what's not working then after that u can fix ur selectedindexchanged event on DDL
Reputation Points: 26
Solved Threads: 19
Posting Whiz in Training
Traicey is offline Offline
283 posts
since Mar 2008
Dec 10th, 2008
0

Re: Master/Detail DropDownList and DataGrid

C# Syntax (Toggle Plain Text)
  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. Response.Write("sql is connected");
  4. SqlDataAdapter da = new SqlDataAdapter("select countryid,countryname from countryname", cn);
  5. DataSet ds = new DataSet();
  6. da.Fill(ds,"countryname");
  7. ddlcountryname.DataSource = ds.Tables["countryname"];
  8. ddlcountryname.DataTextField = "countryname";
  9. ddlcountryname.DataValueField = "countryid";
  10. ddlcountryname.DataBind();
  11.  
  12.  
  13. }
  14. protected void ddlcountryname_SelectedIndexChanged(object sender, EventArgs e)
  15. {
  16. string country_id;
  17. country_id = ddlcountryname.SelectedValue.ToString();
  18. SqlDataAdapter da1=new SqlDataAdapter("select stateid,statename from statename where countryid=' country_id'",cn);
  19. DataSet ds1 = new DataSet();
  20. da1.Fill(ds1, "statename");
  21. ddlstatename.DataSource = ds1.Tables["statename"];
  22. ddlstatename.DataTextField = "statename";
  23. ddlstatename.DataValueField = "stateid";
  24. ddlstatename.DataBind();
  25. }
Last edited by peter_budo; Dec 10th, 2008 at 6:50 am. Reason: Correcting closing tag from [\code] to [/code]
Reputation Points: 7
Solved Threads: 0
Newbie Poster
divyasrinivasan is offline Offline
21 posts
since Dec 2008
Dec 10th, 2008
0

Re: Master/Detail DropDownList and DataGrid

SqlDataAdapter da1=new SqlDataAdapter("select stateid,statename from statename where countryid=' country_id'",cn);
Why your country_ID which you declared as a string is within single and double qoutation marks

Try this and see if it helps
SqlDataAdapter da1=new SqlDataAdapter("select stateid,statename from statename where countryid = " + country_id ,cn);
Last edited by Traicey; Dec 10th, 2008 at 5:57 am.
Reputation Points: 26
Solved Threads: 19
Posting Whiz in Training
Traicey is offline Offline
283 posts
since Mar 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: How to Send email using asp.net with C#
Next Thread in ASP.NET Forum Timeline: how to print the contents of text box





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC