Solved

ASP.net drop down list inside GridView

Posted on 2013-06-07
2
504 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

707 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