473,785 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

radiobutton list and url link

Hi,
Good day.i need some help from you guys.

I'm using vb.net and sql database to build my file.
The purpose of this file is to view news based on deparment.

Im using listbox and radiobutton list in this file.

listbox- to get department names in sql table
radiobutton - to get the headline news for the department name choosen

above.

However, i managed to list all the headline news based on the
department name using listbox and radiobutton.

THE PROBLEM now is how to assign an url link to an item in this
radiobutton list so it will link to the related news.For your
information url addresses are stored in a tabel.
Here are the html declaration:

<form id="Form1" method="post" runat="server">
<P><asp:listb ox id="lblCategory "
OnSelectedIndex Changed="Displa yCategory" AutoPostBack="T rue"
Font-Size="8pt"
Font-Name="arial"
Runat="server"> </asp:listbox></P>
<P> </P>
<asp:radiobutto nlist id="rblSubject " Font-Size="8pt"
Font-Name="arial" Runat="server"
RepeatColumns=" 1"></asp:radiobutton list>
</form>

Here are the vb code :

Inherits System.Web.UI.P age
Protected WithEvents lblCategory As ListBox
Protected WithEvents rblSubject As RadioButtonList

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here

If Not Page.IsPostBack Then
Dim cn As New
SqlConnection(" server=(local); database=AtWork WebPortal;uid=m e;pwd=me")
Dim sql As String = "select DepartmentID, DepartmentName
from Department "
Dim cm As New SqlCommand(sql, cn)
Dim dr As SqlDataReader

cn.Open()
dr = cm.ExecuteReade r
lblCategory.Dat aSource = dr
lblCategory.Dat aTextField = "DepartmentName "
lblCategory.Dat aValueField = "Department ID"
lblCategory.Dat aBind()
lblCategory.Row s = lblCategory.Ite ms.Count

cn.Close()
dr = Nothing
cm = Nothing
cn = Nothing
End If

Public Sub DisplayCategory (ByVal o As Object, ByVal e As EventArgs)

If lblCategory.Sel ectedIndex <> -1 Then
Dim cn As New
SqlConnection(" server=(local); database=AtWork WebPortal;uid=m e;pwd=me")
Dim sql As String = "select DepartmentItemI D, ItemDescr
FROM DepartmentItem WHERE DepartmentID = @DepartmentID "
Dim cm As New SqlCommand(sql, cn)
Dim pm As SqlParameter
Dim dr As SqlDataReader
Dim li As ListItem
pm = cm.Parameters.A dd(New SqlParameter("@ DepartmentID",
SqlDbType.Int))
pm.Value = lblCategory.Sel ectedItem.Value

cn.Open()
dr = cm.ExecuteReade r
rblSubject.Data Source = dr
rblSubject.Data TextField = "ItemDescr"
rblSubject.Data ValueField = "DepartmentItem ID"
rblSubject.Data Bind()

dr.NextResult()
If dr.Read Then
For Each li In rblSubject.Item s
If li.Value = dr("DepartmentI temID") Then
li.Selected = True
Exit For
End If
Next
End If

cn.Close()
dr = Nothing
cm = Nothing
cn = Nothing

End If
Is there any declaration and alteration i need to make?

thank you for your attention.hope to hear from you guys soon.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 21 '05 #1
0 1298

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2852
by: VK | last post by:
Hi! What I'm missing in following code? Cannot get the values of radiobuttons. Starting only one class (GetVariant), it works. When I put two classes together, it doesn't. Regards, VK from Tkinter import * class GetVariant: def __init__(self): self.root = Tk()
11
7874
by: William Gill | last post by:
I am placing radiobuttons in a 4 X 4 matrix (using loops) and keep references to them in a 2 dimensional list ( rBtns ). It works fine, and I can even make it so only one button per column can be selected, by assigning each column to an intVar. In many languages a radiobutton has a property that can be directly read to see if it is selected on unselected. Tkinter radiobuttons don't seem to have any such property. Is there any way to...
3
36185
by: sofie | last post by:
Hello all, I use the following javascript function in a html document to set the level of one of eight available radiobuttons. The line that's commented out works fine under IE, but I need to rewrite it so that it's W3C compliant. Reading through earlier messages I concluded I should go with getElementById but this doesn't work. What am I doing wrong? Your help is much appreciated.
1
1577
by: Sean | last post by:
hi, I have a radiobutton list say, Florida | New York | New Jersey | Texas the radiobutton list has autopostback set to true, as i fire up some code after one of the radiobuttons are selected. Now, i want to be able to traverse the radiobutton using only the keyboard, as i am firing a sql based on the selection, i can't seem to be able to pick Texas as a option, because once Florida is highlighted the sql is fired.
1
1171
by: Gerald | last post by:
Hi, I'm struggling to create a radiobutton list in asp.net c#. I dont want any formatting like the radiobuttonlist do. How can I create checkbox that uses runat server and dont have any formatting. I want to add a radiobutton then anything, then another radiobutton from that group but nothing more. And I need to add some attributes to the radiobox too.
3
3077
by: visual2005beta_developer | last post by:
I have the following problem (especially with the groupname-attribut of the RadioButton-Control) when developing in Visual Studio 2005 Beta. I load an ascx-control in an aspx-page. This ascx-control itself creates dynamically many radiobuttons in this way: foreach (DataRow radiobutton_item in rbl_values.Rows) { RadioButton single_radiobutton = new RadioButton(); single_radiobutton.ID = "idname"; single_radiobutton.GroupName =...
4
1318
by: Ankit Aneja | last post by:
code of my aspx page <asp:RadioButtonList id="RadioButtonList1" runat="server"></asp:RadioButtonList> now i want to bind data from database Dim rsComm As SqlCommand Dim rsReader As SqlDataReader
1
1262
by: Vikas Kumar | last post by:
Hi Guys, Can I hav image with radiobuttonlist control instead of text....? Pls help me in this concern...
1
2561
by: Christiano Donke | last post by:
Hy there, pla.. i have 2 nested repeaters. In the child i have 3 radiobuttons. Already made my homework and figured out how to allow only one radio to be checked.... but now, i can't find out which radio is selected.
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10087
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.