Click here to Skip to main content
16,021,430 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am unable to see dropdown in gridview while page load.

Mycode is below.
----------------


Professional Role Mapping





Edit Professional Role Mapping




<asp:Label ID="LblMessage" runat="server" visible="false" class="red_text">







<asp:GridView ID="GridView1" runat="server" align="center" AllowPaging="True" DataKeyNames="Priority"
AutoGenerateColumns="False" class="tabulardata" DataSourceID="SqlDataSource1"
HorizontalAlign="Center" Width="100%" OnRowCommand="GridView1_RowCommand"
OnRowDataBound="GridView1_RowDataBound">
<columns> <asp:TemplateField HeaderText="Sl.No" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="2%">
<itemtemplate>
<asp:Label ID="Sno" runat="server">

<itemstyle horizontalalign="Center">

<asp:BoundField HeaderText="Project Number" Visible="true" DataField="Priority"
ItemStyle-HorizontalAlign="center" ReadOnly="true" SortExpression="Priority">
<itemstyle horizontalalign="Center" width="3%">

<asp:BoundField HeaderText="Current Designation" Visible="true" DataField="Designation"
ItemStyle-HorizontalAlign="center" ReadOnly="true" SortExpression="Designation">
<itemstyle horizontalalign="Center" width="25%">

<asp:TemplateField HeaderText="Professional Role">
<edititemtemplate>
<asp:DropDownList runat="server" ID="ddlProfRole" DataValueField="ProfRoleCode" DataSourceID="SqlDataSource2" DataTextField="ProfRoleDescription">


<asp:TemplateField HeaderText="Edit" ItemStyle-HorizontalAlign="Center">
<itemtemplate>
<asp:HyperLink ID="hyperlink1" runat="server" Height="20"
ImageUrl="~/images/Access.gif"
Width="20" />

<itemstyle horizontalalign="Center" width="2%">

<alternatingrowstyle backcolor="#FFF5F5">



<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ConnectionStrings:MPP%>"
SelectCommand="select Designation,DesigCode,Priority,ProfRole from Designation order by Priority">
<%--<deleteparameters>
<asp:Parameter Name="emp_number" Type="String" />
--%>

<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ConnectionStrings:MPP%>"
SelectCommand="select ProfRoleCode,ProfRoleDescription,Designcode,DeptID from mppProfRoleMapping order by ProfRoleCode">


pls. help

Regards,
Ganesh.s
Posted
Comments
reid0588 4-Jul-11 8:14am    
hi.. this may help u http://www.dotnetfunda.com/forums/thread536-how-to-add-a-dropdownlist-to-gridview-and-how-to-add-a-datasource-to-d.aspx

1 solution

Hello,

add a blank row to the data table make the datasource to that data table.

it will show you the grid with one blank row.


thanks

sanjeev
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900