Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Handles DropDownList1.SelectedIndexChanged
Dim ddl2 As DropDownList = CType(DetailsView1.FindControl("Dropdownlist2"), DropDownList)
'populate ddl2 items here using DropDownList1.selectedvalue
End Sub
Programming to simplify, dont look for hard way
Marked as answer by Shanker_YPSS on Dec 04, 2012 08:56 AM
Shanker_YPSS
Member
120 Points
220 Posts
How To Do Country-State DropDownList Dependency in DetailsView Control
Dec 02, 2012 05:51 PM|LINK
How To Do Country-State DropDownList Dependency in DetailsView Control??
in insert item and Edit item template.
i have a table structure of
CounrtyName|Statename
oned_gk
All-Star
31681 Points
6473 Posts
Re: How To Do Country-State DropDownList Dependency in DetailsView Control
Dec 03, 2012 12:28 AM|LINK
Set ddl country autopostback then
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged Dim ddl2 As DropDownList = CType(DetailsView1.FindControl("Dropdownlist2"), DropDownList) 'populate ddl2 items here using DropDownList1.selectedvalue End SubShanker_YPSS
Member
120 Points
220 Posts
Re: How To Do Country-State DropDownList Dependency in DetailsView Control
Dec 04, 2012 06:43 AM|LINK
Thanks alot for your post sir.
Can you plz convert this code in c# for me?
oned_gk
All-Star
31681 Points
6473 Posts
Re: How To Do Country-State DropDownList Dependency in DetailsView Control
Dec 04, 2012 06:57 AM|LINK
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddl2 = (DropDownList)DetailsView1.FindControl("Dropdownlist2"); }Shanker_YPSS
Member
120 Points
220 Posts
Re: How To Do Country-State DropDownList Dependency in DetailsView Control
Dec 04, 2012 08:29 AM|LINK
'DropDownListSub_Type_Edit' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
error occurs when i switch to edit from item template.
because at this point there is no data in detailview and i an calling Text='<%# Bind("Sub_Type") %>'.
please guide me.
Shanker_YPSS
Member
120 Points
220 Posts
Re: How To Do Country-State DropDownList Dependency in DetailsView Control
Dec 04, 2012 08:56 AM|LINK
i removed Text='<%# Bind("Sub_Type") %>'. but in edit mode it do not retain its value
your helped me alot thanks..