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

hi,

for Creating Menu in Asp.net

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

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


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;
else
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..")
   ddlEOrder.Visible=true;
else
   ddlEOrder.Visible=False;

Anyone Help to solve this issue

with regards,
ilayaraja