Solved

ASP.net drop down list inside GridView

Posted on 2013-06-07
2
503 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Initial get page response times and IIS8 15 62
edit .asp files 5 49
asp.net web application 3 46
Is it possible to preview ajax call before submitting to the database? 18 63
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…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 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