Sir,
I have done this using Access Database. Here's my HTML and .vb code:
HTML CODE:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="radiobuttons.aspx.vb" Inherits="radiobuttons" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<table>
<tr>
<td align="left" valign="top">
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
<td>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table width="650" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" align="left" valign="middle"> </td>
</tr>
<tr>
<td height="2" align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="638" width="619">
<tr>
<td align="center" valign="top" width="638">
<div style="border:2px solid #e4e4e4; width:638px; padding: 13px 0px 13px 0px;">
<table border="0" cellpadding="0" cellspacing="0" width="620">
<tr>
<td align="left" class="pkgdiscriptiontitle" valign="top" width="120">
Hotel Type:
</td>
<td align="left" width="480">
<asp:RadioButton ID="radio1" runat="server" AutoPostBack="true"
Font-Names="arial" Font-Size="11px" GroupName="hoteltype" Text="Standard" />
<asp:RadioButton ID="radio2" runat="server" AutoPostBack="true"
Font-Names="arial" Font-Size="11px" GroupName="hoteltype" Text="Deluxe" />
</td>
</tr>
<tr>
<td align="left" colspan="2" height="10" valign="top" width="620">
</td>
</tr>
<tr>
<td align="center" colspan="2" valign="top" width="620">
<asp:Label ID="lbltab5" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="2" ></td>
</tr>
<tr>
<td height="15" align="center" valign="middle">
</td>
</tr>
<tr>
<td height="14" align="center">
</td>
</tr>
<tr>
<td height="3"></td>
</tr>
<tr>
<td valign="top">
<table width="650" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" align="left" height="15">
</td>
</tr>
<tr>
<td valign="top" height="10"></td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="radio1" />
<asp:PostBackTrigger ControlID="radio2" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
.vb CODE:
Imports System.Data.OleDb
Imports System.Data
Partial Class radiobuttons
Inherits System.Web.UI.Page
Dim constr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & Server.MapPath("website.mdb")
Public pd As String = ""
Public ite As String = ""
Public inclu As String = ""
Public hi As String = ""
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
If Request.QueryString("htype") = "standard" Then
radio1.Checked = True
radio2.Checked = False
ElseIf Request.QueryString("htype") = "deluxe" Then
radio1.Checked = False
radio2.Checked = True
Else
radio1.Checked = True
radio2.Checked = False
End If
If Request.QueryString("intype") <> Nothing And Request.QueryString("htype") <> Nothing Then
fill_hoteldetails(Request.QueryString("pkgid"), Request.QueryString("htype"))
Else
fill_hoteldetails(Request.QueryString("pkgid"), "standard")
End If
End If
End Sub
Protected Sub radio1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radio1.CheckedChanged
'Response.Redirect("radiobuttons.aspx?sid=" & Request.QueryString("sid") & "&c=" & Request.QueryString("c") & "&sc=" & Request.QueryString("sc") & "&q=" & Request.QueryString("q") & "&pkgid=" & Request.QueryString("pkgid") & "&pkgtitle=" & Request.QueryString("pkgtitle") & "&intype=deluxe&htype=standard", False)
Response.Redirect("radiobuttons.aspx?htype=standard", False)
End Sub
Protected Sub radio2_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radio2.CheckedChanged
'Response.Redirect("radiobuttons.aspx?sid=" & Request.QueryString("sid") & "&c=" & Request.QueryString("c") & "&sc=" & Request.QueryString("sc") & "&q=" & Request.QueryString("q") & "&pkgid=" & Request.QueryString("pkgid") & "&pkgtitle=" & Request.QueryString("pkgtitle") & "&intype=deluxe&htype=deluxe", False)
Response.Redirect("radiobuttons.aspx?htype=deluxe", False)
End Sub
Sub fill_hoteldetails(ByVal id As Integer, ByVal hoteltype As String)
Try
Dim hs As Integer = 0 'Hotel Standard
Dim hd As Integer = 0 'Hotel Deluxe
Dim con As New OleDbConnection(constr)
Dim cmd As New OleDbCommand()
'--to check for standard
cmd = New OleDbCommand("select count(ID) from radiobuttons where htype='standard'", con)
Dim dr As OleDbDataReader
con.Open()
dr = cmd.ExecuteReader
If dr.HasRows Then
While dr.Read
hs = dr(0)
End While
End If
con.Close()
'--to check for deluxe
cmd = New OleDbCommand("select count(ID) from radiobuttons where htype='deluxe'", con)
Dim dr2 As OleDbDataReader
con.Open()
dr2 = cmd.ExecuteReader
If dr2.HasRows Then
While dr2.Read
hd = dr2(0)
End While
End If
con.Close()
If hs > 0 And hd = 0 Then '//if only standard avaliable
radio1.Visible = True
radio1.Checked = True
radio2.Visible = False
ElseIf hs = 0 And hd > 0 Then '//if only deluxe avaliable
radio2.Visible = True
radio2.Checked = True
radio1.Visible = False
ElseIf hs > 0 And hd > 0 Then '//if both avaliable
radio1.Visible = True
radio2.Visible = True
radio1.Checked = True
End If
If Request.QueryString("htype") = Nothing Then
If hs > 0 Then
hoteltype = "standard"
ElseIf hd > 0 Then
hoteltype = "deluxe"
End If
Else
hoteltype = Request.QueryString("htype")
End If
Dim x As String = ""
cmd = New OleDbCommand("select * from radiobuttons where htype='" & hoteltype & "'", con)
Dim dr3 As OleDbDataReader
con.Open()
dr3 = cmd.ExecuteReader
If dr3.HasRows Then
x = "<table cellpadding='0' cellspacing='0' width='100%' border='0'>"
While dr3.Read
x = x & "<tr>"
x = x & "<td class='pkgsidetitle' height='22' align='left' valign='top'>" & dr3("information1") & "</td>"
x = x & "</tr>"
x = x & "<tr>"
x = x & "<td class='pkgsidetitle' height='1' align='left' valign='top' style='background-color:#ededed;'></td>"
x = x & "</tr>"
x = x & "<tr>"
x = x & "<td class='pkgsidetitle' height='12' align='left' valign='top'></td>"
x = x & "</tr>"
End While
x = x & "</table>"
Else
x = "<font face='arial' size='2'></i>Hotel details not available</i></font>"
End If
con.Close()
lbltab5.Text = x
Catch ex As Exception
lbltab5.Text = ex.ToString
End Try
End Sub
End Class