I have a radio button i want it to bind with database field
when i click on the radio button it will call the value n get displayed all data in textbox given.
how to do it

Hi,

Attached is the code.

find the attachment and shoot out ur queries.:)

gud day

bye

0 then lobjconn.ConnectionString= "provider=sqloledb;server=ravigopal;initial catalog=expense;integrated security=true" lobjconn.open lobjcmd.activeconnection=lobjconn lobjcmd.commandtype=1 lobjcmd.commandtext="select text1 from country where id=" + lstrid lobjcmd.execute() lobjconn.closeend if%>function fnsubmit(optid){ document.form1.method="post"; document.form1.action="sample.asp?id="+optid; document.form1.submit();} 0 then lobjconn.ConnectionString= "provider=sqloledb;server=ravigopal;initial catalog=expense;integrated security=true" lobjconn.open lobjcmd.activeconnection=lobjconn lobjcmd.commandtype=1 lobjcmd.commandtext="select text1 from country where id=" + lstrid lobjcmd.execute() lobjconn.closeend if%>function fnsubmit(optid){ document.form1.method="post"; document.form1.action="sample.asp?id="+optid; document.form1.submit();}

Attachments
<%

dim lobjconn
dim lobjcmd
dim lobjrs
dim lstrid

set lobjconn = server.CreateObject("adodb.connection")
set lobjcmd = server.CreateObject("adodb.command")
set lobjrs = server.CreateObject("adodb.recordset")

lstrid=Request.QueryString("id")

if len(lstrid)>0 then

	lobjconn.ConnectionString= "provider=sqloledb;server=ravigopal;initial catalog=expense;integrated security=true"
	lobjconn.open

	lobjcmd.activeconnection=lobjconn
	lobjcmd.commandtype=1
	lobjcmd.commandtext="select text1 from country where id=" + lstrid

	lobjcmd.execute()

	lobjconn.close


end if

%>
<html>

<head>
<script>
function fnsubmit(optid)
{

	
	document.form1.method="post";
	document.form1.action="sample.asp?id="+optid;
	document.form1.submit();
}
</script>
</head>
<body>
<form id="form1" name="active">
<input type="radio" id="rd1" value="1" onclick="javscript:fnsubmit(1)"></option>
<input type="radio" id="rd2" value="2"></option>

</form>	
</body>
</html>

Here is an example using Northwind.

<%

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "provider=sqloledb;server=xx.xx.xx.xx;initial catalog=northwind;user id=xx;password=xx;"
Set objRSCategories = Server.CreateObject("ADODB.Recordset")

lstrid=Request("catid")
%>
<html>
<head>
</head>
<body>
<form id="form1" name="form1" method="get">
<%
objConn.Open
categoryQuery="SELECT [CategoryID] FROM [Northwind].[dbo].[Categories] "

objRSCategories.Open categoryQuery, objConn

Do Until objRSCategories.EOF = True
    catid=objRSCategories("CategoryID")
    %>
    <input type="radio" name="catid" id="rd1" value="<%= catid %>" onclick="this.form.submit();"><%= catid %><br>
    <%
    objRSCategories.MoveNext
Loop

If Len(lstrid) > 0 then
    descQuery="SELECT [Description] FROM [Northwind].[dbo].[Categories] where CategoryID=" & lstrid
    Set objRSDesc = Server.CreateObject("ADODB.Recordset")

    objRSDesc.Open descQuery, objConn
    desc = ""
    Do Until objRSDesc.EOF = True
        desc = desc & objRSDesc("Description")
        objRSDesc.MoveNext
    Loop
    %>
    <textarea name="t1" cols="10" rows="5"><%= desc %></textarea>
    <%
End If

objConn.close

%>
</form>    
</body>
</html>
This article has been dead for over six months. Start a new discussion instead.