Click here to Skip to main content
15,894,460 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to create a gridview with a fixed number of rows (5). If the gridivew contains no items then five blank rows will be shown. n Thank you.
just like http://www.fullonsms.com/AddMultiContacts.php?GroupId=[^]
In my project the no of row is showing according to no of item present in dropdown.
below is my sourcecode.

C#
<asp:GridView ID="GridView1" runat="server" 
        onselectedindexchanged="GridView1_SelectedIndexChanged" 
        onrowdatabound="GridView1_RowDataBound" DataKeyNames="Group_ID" 
        AutoGenerateColumns="False" Height="100%" AllowPaging="True" PageSize="5" ShowFooter="true">
        <columns>
        <asp:TemplateField HeaderText="Gender"><itemtemplate>
            <asp:DropDownList ID="DropDownList1" runat="server" >
            <asp:ListItem >Mr
             <asp:ListItem>Ms
             </itemtemplate>
        
            <asp:TemplateField HeaderText="Name">
            <itemtemplate> 
                <asp:TextBox ID="nametxt" runat="server" onfocus="javascript:if(value == 'Name')value = '';"  
                     onblur="javascript:if(value == '')value = 'Name';style.color='Gray'">Name
            </itemtemplate>
            
            <asp:TemplateField HeaderText="MobileNo">
            <itemtemplate> 
                <asp:TextBox ID="mobilenotxt" runat="server"  onfocus="javascript:if(value == 'MobileNo')value = '';"  
                     onblur="javascript:if(value == '')value = 'MobileNo';style.color='Gray'">MobileNo
            </itemtemplate>
            
            <asp:TemplateField HeaderText="EmailID">
            <itemtemplate> 
                <asp:TextBox ID="Emailidtxt" runat="server" onfocus="javascript:if(value == 'EmailID')value = '';"  
                     onblur="javascript:if(value == '')value = 'MobileNo';style.color='Gray'">EmailID
            </itemtemplate>
            
            <asp:TemplateField HeaderText="City" >
            <itemtemplate> 
                <asp:TextBox ID="Citytxt" runat="server"  onfocus="javascript:if(value == 'City')value = '';"  
                     onblur="javascript:if(value == '')value = 'City';style.color='Gray'">City
            </itemtemplate>
            
            <asp:TemplateField HeaderText="Group">
            
            <itemtemplate>
          
               <asp:DropDownList ID="DropDownList2" runat="server"  >
               
                
                
               
           
            </itemtemplate>
             <footerstyle horizontalalign="Right" />

            <footertemplate>

             <asp:Button ID="ButtonAdd" runat="server" Text="Add New Row" />

            </footertemplate>

            
            
        </columns>
    

<rowstyle backcolor="#F7F7DE" />

<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />

<pagerstyle backcolor="#F7F7DE" forecolor="Black" horizontalalign="Right" />

<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />

<alternatingrowstyle backcolor="White" />
<emptydatatemplate>

<asp:DropDownList ID="DropDownList1" runat="server" >
<asp:ListItem Selected="False">Mr
 <asp:ListItem>Ms

 <asp:TextBox ID="nametxt" runat="server">Name
<asp:TextBox ID="mobilenotxt" runat="server">MobileNo 
<asp:TextBox ID="Emailidtxt" runat="server">EmailID 
<asp:TextBox ID="Citytxt" runat="server" >City
<asp:DropDownList ID="DropDownList2" runat="server"  ><asp:ListItem>select
                
</emptydatatemplate>


kindly suggest me
Posted
Updated 22-Oct-11 10:25am
v3

1 solution

 
Share this answer
 
Comments
Member 8181730 29-Oct-11 5:41am    
dont give stupid solution

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