p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 3.5 Basics (http://p2p.wrox.com/forumdisplay.php?f=351)
-   -   Two DropDownList Inside a Gridview (http://p2p.wrox.com/showthread.php?t=66939)

ilayaraja March 27th, 2008 02:17 AM

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





HPro March 28th, 2008 06:53 PM

Best I can tell that should be working but I ran the same code here and got the same non-results. Hopefully someone else can chime in.



Heather

workib May 3rd, 2008 08:21 PM

Hello,

I have used the following code to put drop down list inside of a grid. I hope this helps.

</ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="INTAKE_DATE" DataFormatString="{0:d}"
                HeaderText="INTAKE_DATE" SortExpression="INTAKE_DATE" />
            <asp:TemplateField HeaderText="STATUS" SortExpression="STATUS">
                 <EditItemTemplate>
                    <asp:DropDownList ID="STATUSDropDownList" runat="server" AutoPostBack="true"
                        SelectedValue='<%# Bind("STATUS", "{0}") %>'>
                        <asp:ListItem Text="ADD DROP DOWN LIST ITEMS" Value="ADD DROP DOWN LIST ITEMS" Enabled="true"></asp:ListItem>
                    </asp:DropDownList>
                 </EditItemTemplate>
                 <ItemTemplate>
                     <asp:DropDownList ID="STATUSDropDownList" runat="server" AutoPostBack="true"
                         SelectedValue='<%# Bind("STATUS", "{0}") %>'>
                         <asp:ListItem Enabled="true" Text="ADD DROP DOWN VALUES"
                             Value="ADD DROP DOWN VALUES"
"></asp:ListItem>
                     </asp:DropDownList>
                 </ItemTemplate>
            </asp:TemplateField>
Brian

reham114 December 5th, 2008 06:26 PM

i want to put dropdownlist inside gridveiw
and by changing selectrd value in dropdown rest of colum of gridview change


R


All times are GMT -4. The time now is 08:19 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.