TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
shuchi
NA
10
0
Problem in populating a dropdown list in a datagrid. Every row has a dropdown list. how to populate?
Nov 29 2006 1:29 AM
Hi, I have a web form. I am using sql dataadapter, dataset and datagrid for displaying the data. (C#) In first column of all the rows, I have dropdown list that I want to populate on the fly. (so, number of dropdown lists = number of rows) Some of the options in the drop down list are common (e.g.: "View the Order", "Open the Order", "Print the Order" etc.) where as some of the options are specific to the Order Number (e.g.: "Order ######" etc.). Order # is the next column in the datagrid. So, I want to basically capture this Order # and put it as an available option in the dropdown list of the current row. (there is a unique Order # for every row and that # must be the option in the drop down list). How do we do this?
I have written common options in the html section, but I need the Order # which are generated on the fly based on the main SQL statement.
<asp:DataGrid ID="mygrid2" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="Black" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" OnItemDataBound="mygrid2_ItemDataBound">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:DropDownList ID="ddlnestedmygrid2" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlst_Handler">
<asp:ListItem Value="1">View Order</asp:ListItem>
<asp:ListItem Value="2">Print Order</asp:ListItem>
<asp:ListItem Value="3">Copy Order</asp:ListItem>
<asp:ListItem Value="0">============</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="OSP_OrderNum" HeaderText="Order #"></asp:BoundColumn>
<asp:BoundColumn DataField="ORD_DateIn" HeaderText="Order Date" DataFormatString="{0:MM/dd/yyyy}" ></asp:BoundColumn>
<asp:BoundColumn DataField="OSP_FSD" HeaderText="ETD Date" DataFormatString ="{0:MM/dd/yyyy}"></asp:BoundColumn>
<asp:BoundColumn DataField="CustomerNameLong" HeaderText="Customer"></asp:BoundColumn>
<asp:BoundColumn DataField="ccdCustomerName" HeaderText="Customer Of Customer"></asp:BoundColumn>
<asp:BoundColumn DataField="ORD_ShoeName" HeaderText="Shoe Name"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Cust PO/Stk#">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "OSP_CustomerPO") + "/" + DataBinder.Eval(Container.DataItem, "OSP_CustomerStk")%>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="OSP_ActualQty" HeaderText="Qty"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Approval Sales/OPD">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "ORD_StatusUSASales") + "/" + DataBinder.Eval(Container.DataItem, "ORD_StatusUSAOPD")%>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="ORD_Split" HeaderText="Split"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
Reply
Answers (
0
)
get this exciting book
Page load progress.....