| | |
Radiobuttons within Gridview
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2007
Posts: 84
Reputation:
Solved Threads: 0
I am designing a page containing a gridview that takes the data from a dataSource
the data are evaluation questions (20 questions) and the answers are degree of five represented by radiobuttons
I added the radio buttons to the gridview as template item
Like this :
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="4" DataKeyNames="question#" DataSourceID="SqlDataSource" ForeColor="#333333"
GridLines="None" Style="z-index: 102; right: 2px; position: relative; top: -41px" Width="649px" Height="199px">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="question#" HeaderText="no " InsertVisible="False" ReadOnly="True"
SortExpression="question#" />
<asp:BoundField DataField="question" HeaderText="Question" SortExpression="question">
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:TemplateField HeaderText="answers">
<ItemTemplate>
<asp:RadioButton ID="btn5" Text="excellent" runat="server" Font-Size="X-Small" GroupName="answer"/>
<asp:RadioButton ID="btn4" Text="v good" runat="server" Font-Size="X-Small" GroupName="answer"/>
<asp:RadioButton ID="btn3" Text="good" runat="server" Font-Size="X-Small" GroupName="answer"/>
<asp:RadioButton ID="btn2" Text="weekly good" runat="server" Font-Size="X-Small" GroupName="answer" />
<asp:RadioButton ID="btn1" Text="bad" runat="server" Font-Size="X-Small" GroupName="answer" />
</ItemTemplate>
<ItemStyle Width="230px" />
</asp:TemplateField>
</Columns>
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
but now I want to get the answer of each question but I have no idea how that could be accomplished
if some one has any idea please help me
the data are evaluation questions (20 questions) and the answers are degree of five represented by radiobuttons
I added the radio buttons to the gridview as template item
Like this :
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="4" DataKeyNames="question#" DataSourceID="SqlDataSource" ForeColor="#333333"
GridLines="None" Style="z-index: 102; right: 2px; position: relative; top: -41px" Width="649px" Height="199px">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="question#" HeaderText="no " InsertVisible="False" ReadOnly="True"
SortExpression="question#" />
<asp:BoundField DataField="question" HeaderText="Question" SortExpression="question">
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:TemplateField HeaderText="answers">
<ItemTemplate>
<asp:RadioButton ID="btn5" Text="excellent" runat="server" Font-Size="X-Small" GroupName="answer"/>
<asp:RadioButton ID="btn4" Text="v good" runat="server" Font-Size="X-Small" GroupName="answer"/>
<asp:RadioButton ID="btn3" Text="good" runat="server" Font-Size="X-Small" GroupName="answer"/>
<asp:RadioButton ID="btn2" Text="weekly good" runat="server" Font-Size="X-Small" GroupName="answer" />
<asp:RadioButton ID="btn1" Text="bad" runat="server" Font-Size="X-Small" GroupName="answer" />
</ItemTemplate>
<ItemStyle Width="230px" />
</asp:TemplateField>
</Columns>
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
but now I want to get the answer of each question but I have no idea how that could be accomplished

if some one has any idea please help me
there's always something to learn
•
•
Join Date: Apr 2006
Posts: 88
Reputation:
Solved Threads: 2
Here is two websites for you that will answer your questions (I hope).
This will get you familiar with using SQL DataSource. Which I think you already know.
http://www.codersource.net/asp_net_gridviewcontrol.aspx
This website is going to show you how to use controls inside a GridView. The tutorial is specific on checkboxes. http://www.asp.net/learn/data-access...ial-52-vb.aspx
I can post some more code in detail but right now in a hurry.
This will get you familiar with using SQL DataSource. Which I think you already know.
http://www.codersource.net/asp_net_gridviewcontrol.aspx
This website is going to show you how to use controls inside a GridView. The tutorial is specific on checkboxes. http://www.asp.net/learn/data-access...ial-52-vb.aspx
I can post some more code in detail but right now in a hurry.
Hi,
U didnt specify exactly wat u r problem was,but from my previous experience i had problem with radio button in a grid view.I wanted the radiobuttons to be under one group name and that task was not accomplished.I have used the following threads to solve the problem,hope they are useful
http://aspnet.4guysfromrolla.com/articles/122602-1.aspx
http://www.codeproject.com/aspnet/Ho...sp?msg=1188105
U didnt specify exactly wat u r problem was,but from my previous experience i had problem with radio button in a grid view.I wanted the radiobuttons to be under one group name and that task was not accomplished.I have used the following threads to solve the problem,hope they are useful
http://aspnet.4guysfromrolla.com/articles/122602-1.aspx
http://www.codeproject.com/aspnet/Ho...sp?msg=1188105
HI,
SINCE THIS PROBLEM NOT MARKED YET I WANT TO SHARE MY EXPERIENCE. TODAY I RESOLVE THIS ISSUE BY THE FOLLOWING POST:
http://shawpnendu.blogspot.com/2009/...on-across.html
Hope It will help my frnds a lot.
SINCE THIS PROBLEM NOT MARKED YET I WANT TO SHARE MY EXPERIENCE. TODAY I RESOLVE THIS ISSUE BY THE FOLLOWING POST:
http://shawpnendu.blogspot.com/2009/...on-across.html
Hope It will help my frnds a lot.
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: help required
- Next Thread: how to make a pie or bar chart in asp.net?
Views: 5828 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 activexcontrol advice ajax anathor application asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child click commonfunctions compatible confirmationcodegeneration content contenttype courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownmenu edit expose feedback flash flv form formatdecimal forms formview google grid gridview homeedition hosting identity iframe iis index javascript jquery list menu migration mono mssql multistepregistration nameisnotdeclared object objects order problem ratings refer rotatepage save search security serializesmo.table session silverlight smartcard software sql sqlserver2005 suse textbox tracking typeof unauthorized update validation vb vb.net video view virtualdirectory vista visual-studio visualstudio web webarchitecture webdevelopemnt xml youareanotmemberofthedebuggerusers





