View Single Post
  #1 (permalink)  
Old March 27th, 2008, 02:17 AM
ilayaraja ilayaraja is offline
Registered User
Join Date: Mar 2008
Location: madurai, tamilnadu, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ilayaraja
Default Two DropDownList Inside a Gridview


for Creating Menu in

 <asp:TemplateField HeaderText="Order ID">
 <asp:Label ID="lbliOrder" runat="server" Text='<%#Eval("iOrder") %>'></asp:Label>
 <asp:DropDownList ID="ddlOrgId" runat="server" DataSource="<%# DropDownData %>"
 DataTextField="strPageHeader" DataValueField="strPageHeader"
 AutoPostBack="True" onselectedindexchanged="ddlOrgId_SelectedIndexChan ged"
 SelectedValue="<%# DropDownSel %>">
 <asp:DropDownList ID="ddlstParent" runat="server" DataSource="<%# DropDownData %>"
 DataTextField="strPageHeader" DataValueField="strPageHeader"
 AutoPostBack="true" onselectedindexchanged="ddlstParent_SelectedIndexC hanged">
            <asp:TemplateField HeaderText="OrderList">
                        <asp:Label ID="lblOrderList" runat="server" Text='<%#Eval("iParentOrder") %>'></asp:Label>
                     <asp:DropDownList ID="ddlstEOrder" runat="server" DataSource="<%# MyData1 %>"
                      DataTextField="iParentOrder" DataValueField="iParentOrder"

                      SelectedValue="<%# DropDownSelParent %>" Visible="False" >
                     <asp:DropDownList ID="ddlstOrder" runat="server" DataSource="<%#MyData %>" DataTextField="iParentOrder"
                             Visible="False" AutoPostBack="True" >

my table structure is given below

ikeyid Bigint,iOrganizationKeyid BigInt, strPageHeader varchar(200), strPageUrl varchar(250),iOrder int,iParentOrder int

values as follows
ikeyid iOrganizationKeyid strPageHeader strPageUrl iOrder iParentOrder
1 0 Home -1 1
2 0 Mail -1 2
3 0 Aboutus -1 3
4 0 Yahoo 2

iKeyid is the Parent
iOrder is the Child

if iOrder is -1 is said to be a Parent and it has a iParentOrder value also

if iOrder is not -1 it will not have iParentOrder

im having a Admin Dash Board to insert update delete
in whichi im having 2 dropdown list for iOrder and iParentOrder
iOrder will display the Parent Header value in the dropdown according to the value in IOrder. if it is -1 is a display as "New Parent.." if im selecting this object the dropdown list for

iParentOrder.Visible =true;
iParentOrder.Visible =False;

it is working if the dropdownlistselected index changed.

During Edit:
dropdownlist SelectedValue is not visible even it shown "NewParent.." as Selected Value at that time SelectedIndexChange event will not fire
How to make my DropDownList in Edit time to Display on Checking the Value

if(iOrder==-1 or ddlstOrder.Tex=="New Parent..")

Anyone Help to solve this issue

with regards,