Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 27th, 2008, 02:17 AM
Registered User
 
Join Date: Mar 2008
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




 
Old March 28th, 2008, 06:53 PM
Registered User
 
Join Date: Feb 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old May 3rd, 2008, 08:21 PM
Authorized User
 
Join Date: Apr 2008
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old December 5th, 2008, 06:26 PM
Registered User
 
Join Date: Dec 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


R





Similar Threads
Thread Thread Starter Forum Replies Last Post
DropDownList Inside FormView Problem frogosteve ASP.NET 2.0 Basics 0 April 12th, 2007 10:30 AM
DropDownList Inside a datagrid @shish ASP.NET 1.0 and 1.1 Professional 3 January 29th, 2007 07:24 PM
dropdownlist inside datagrid myunus General .NET 11 October 29th, 2006 07:37 AM
DropDownList inside a GridView aidoco ASP.NET 2.0 Basics 0 October 13th, 2006 04:24 AM
dropdownlist inside datagrid shaileshmark General .NET 5 June 27th, 2004 05:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.