Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,797 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,319 people online right now. Registration is fast and FREE... Join Now!




radiobutton help

 
Reply to this topicStart new topic

radiobutton help

nikith
19 Sep, 2008 - 01:43 AM
Post #1

New D.I.C Head
*

Joined: 15 Sep, 2008
Posts: 2

I have a form with 4 multiple choice questions. For each multiple choice question there are 4 options which are same for all the 4 questions.
I am using radio buttons with groupname for each question.
When I click submit button, selected values from all the 4 questions should be inserted into database.
How can I do this? Please help as I am new to asp.net
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Radiobutton Help
19 Sep, 2008 - 05:18 AM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,997



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is offlineProfile CardPM
+Quote Post

nikith
RE: Radiobutton Help
19 Sep, 2008 - 07:21 AM
Post #3

New D.I.C Head
*

Joined: 15 Sep, 2008
Posts: 2

My code is


CODE


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title> Page</title>
</head>
<body>
    <form id="form1"  runat="server">
    <div>
        1. aaa ....<br />
        <asp:RadioButton ID="RadioButton1" runat="server" Style="z-index: 100; left: 54px;
            position: absolute; top: 81px" GroupName="a" Height="20px" Text="One" Width="58px" />
        <asp:RadioButton ID="RadioButton2" runat="server" Style="z-index: 101; left: 186px;
            position: absolute; top: 78px" GroupName="a" Height="20px" Text="Two" Width="53px" />
        <asp:RadioButton ID="RadioButton3" runat="server" Style="z-index: 102; left: 331px;
            position: absolute; top: 80px" GroupName="a" Text="Three" Width="125px" />
        <br />
        <br />
        <br />
            
        2. bbb.....<br />
        <asp:RadioButton ID="RadioButton4" runat="server" GroupName="b" Height="20px" Style="z-index: 103;
            left: 54px; position: absolute; top: 209px" Text="One" Width="58px" />
        <asp:RadioButton ID="RadioButton5" runat="server" GroupName="b" Height="20px" Style="z-index: 104;
            left: 186px; position: absolute; top: 203px" Text="Two" Width="53px" />
        <asp:RadioButton ID="RadioButton6" runat="server" GroupName="b" Style="z-index: 106;
            left: 331px; position: absolute; top: 204px" Text="Three" Width="125px" />        
        <br />
        <br />
         3. ccc...<br />
        <asp:RadioButton ID="RadioButton7" runat="server" GroupName="c" Height="20px" Style="z-index: 108;
            left: 54px; position: absolute; top: 331px" Text="One" />
        <asp:RadioButton ID="RadioButton8" runat="server" GroupName="c" Height="20px" Style="z-index: 105;
            left: 186px; position: absolute; top: 330px" Text="Two" />
      
        <asp:RadioButton ID="RadioButton9" runat="server" GroupName="c" Style="z-index: 107;
            left: 331px; position: absolute; top: 328px" Text="Three" />
        <br />
        <br />
          
        <br />
        <asp:Button ID="Submit" runat="server" Style="z-index: 110; left: 211px; position: absolute;
            top: 411px" Text="Submit" />
        <br />
    
    </div>
    </form>
</body>
</html>




Protected Sub Submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit.Click
        Dim sqlcn As New SqlConnection
        Dim sqlcd As New SqlCommand
        Dim SqlStr As String
        sqlcn.ConnectionString = "XXXX"
        sqlcn.Open()
        SqlStr = " "
        sqlcd.CommandText = SqlStr
        sqlcd.Connection = sqlcn
        sqlcd.ExecuteNonQuery()
        sqlcd = Nothing

    End Sub
End Class




How to write sql statement to insert values of selected radio buttons into database?
Database column names are a1,a2,a3


Thanks

This post has been edited by nikith: 19 Sep, 2008 - 07:23 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 01:49PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month