Solved

ASP.net drop down list inside GridView

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
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…

785 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