Solved

ASP.net drop down list inside GridView

Posted on 2013-06-07
2
499 Views
Last Modified: 2013-06-07
Hi. I have the following GridView with radio buttons in
I need to replace these with drop down lists. Each drop down list needs to
contain four options: 1, 2, 3 and 4

            <asp:GridView ID="GridView2" runat="server"
    font-names="Century Gothic" forecolor="White" style="margin-top: 0px">
                <Columns>
     
                    <asp:TemplateField ControlStyle-Font-Bold="false"
            ControlStyle-Font-Size="Smaller" ControlStyle-Forecolor="DarkRed"
            HeaderStyle-Font-Size="Small" HeaderText="" HeaderStyle-Width="80">
                        <ItemTemplate>
                                  <asp:RadioButton ID="Button6" runat="server"
                      CommandName="MyButton1"
                      CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
                      Text="A" Width="80" />
                                  <asp:RadioButton ID="Button7" runat="server"
                      CommandName="MyButton2"
                      CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
                      Text="B" Width="80" />
                                  <asp:RadioButton ID="Button8" runat="server"
                      CommandName="MyButton3"
                      CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
                      Text="C" Width="80" />
                                  <asp:RadioButton ID="Button9" runat="server"
                      CommandName="MyButton4"
                      CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
                      Text="D" Width="80" />
       
                     
                        </ItemTemplate>
0
Comment
Question by:murbro
2 Comments
 
LVL 8

Accepted Solution

by:
rpkhare earned 500 total points
ID: 39231158
Do changes as below:

<asp:TemplateField>
     <ItemTemplate>
          <asp:DropDownList ID="ddlOptions" runat="server">
                <asp:ListItem>1</asp:ListItem>
                <asp:ListItem>2</asp:ListItem>
                <asp:ListItem>3</asp:ListItem>
                <asp:ListItem>4</asp:ListItem>
         </asp:DropDownList>
     </ItemTemplate>
</asp:TemplateField>

Open in new window


Check this link also:
Dropdownlist inside the Gridview in ASP.NET
0
 

Author Closing Comment

by:murbro
ID: 39231164
Thanks very much
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
HTML table 7 55
Put text in a picture ASP.NET C# 2 37
Problem to go to Web page 2 52
ASP.net VB.net Email  a webpage 3 27
Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now