Hello,
I am trying to get the value of the radiobuttonlist . The problem is
that I need it to be unselected at every page load. The
radiobuttonlist is set to autopostback (true).
My idea is simple. When I select a value, I get it, insert something
into the database with that value and the page loads again with
different data. Imagine a questionnaire and every page load a random
question would be load on screen and when the user clicks the
radiobutton list, I get the value, insert into the database and only
after I do the page_load again. Is there any way of doing this without
a button, and setting the selecteditemcha nged to fire first then the
page_load?
Tks for the help.
The code is simple!
'My Page load is working just the way I want it!
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
If Not Page.IsPostBack Then
RadioButtonList 1.ClearSelectio n() ' I need it to be clear
each time!
leftPanel.Visib le = False
Dim users As New ArrayList
users = User_.ArrayOfUs ers
Session.Add("us ers", users)
Session.Add("i" , 0)
i = 0
details = User_.getQuesti ons(users.Item( i))
Image.ImageUrl = details(1).ToSt ring
lblLastChecked. Text = details(3).ToSt ring
details.Clear()
'users.Clear()
Else
'RadioButtonLis t1.ClearSelecti on()
i = CType(Session(" i"), Integer)
Dim users_tmp As ArrayList
users_tmp = CType(Session(" users"), ArrayList)
If (i < users_tmp.Count - 1) Then
detailsAfterRat ing =
User_.getQuesti ons(users_tmp.I tem(i))
details = User_.getQuesti ons(users_tmp.I tem((i + 1)))
Image.ImageUrl = details(1).ToSt ring
lblLastChecked. Text = details(3).ToSt ring
RatedImage.Imag eUrl = detailsAfterRat ing(2).ToString
lblRating.Text = detailsAfterRat ing(5).ToString
lblPastRate.Tex t = Session("youRat ed")
i = (i + 1)
Session.Add("i" , i)
'details.Clear( )
'detailsAfterRa ting.Clear()
leftPanel.Visib le = True
Else
Response.Redire ct("Homepage.as px")
End If
End If
End Sub
'This works fine, but only after the page_load. So the first time is
ok, but the second time I need it to be clear and to do something
before it goes to page_load again.
Protected Sub RadioButtonList 1_SelectedIndex Changed(ByVal sender
As System.Object, ByVal e As System.EventArg s) Handles
RadioButtonList 1.SelectedIndex Changed
Dim answer As String
answer = RadioButtonList 1.SelectedValue .ToString
'Code for inserting into database...
End Sub
Tks for all the help. 2 4004
move your page load code to prerender
-- bruce (sqlwork.com) ri************* ******@googlema il.com wrote:
Hello,
I am trying to get the value of the radiobuttonlist . The problem is
that I need it to be unselected at every page load. The
radiobuttonlist is set to autopostback (true).
My idea is simple. When I select a value, I get it, insert something
into the database with that value and the page loads again with
different data. Imagine a questionnaire and every page load a random
question would be load on screen and when the user clicks the
radiobutton list, I get the value, insert into the database and only
after I do the page_load again. Is there any way of doing this without
a button, and setting the selecteditemcha nged to fire first then the
page_load?
Tks for the help.
The code is simple!
'My Page load is working just the way I want it!
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
If Not Page.IsPostBack Then
RadioButtonList 1.ClearSelectio n() ' I need it to be clear
each time!
leftPanel.Visib le = False
Dim users As New ArrayList
users = User_.ArrayOfUs ers
Session.Add("us ers", users)
Session.Add("i" , 0)
i = 0
details = User_.getQuesti ons(users.Item( i))
Image.ImageUrl = details(1).ToSt ring
lblLastChecked. Text = details(3).ToSt ring
details.Clear()
'users.Clear()
Else
'RadioButtonLis t1.ClearSelecti on()
i = CType(Session(" i"), Integer)
Dim users_tmp As ArrayList
users_tmp = CType(Session(" users"), ArrayList)
If (i < users_tmp.Count - 1) Then
detailsAfterRat ing =
User_.getQuesti ons(users_tmp.I tem(i))
details = User_.getQuesti ons(users_tmp.I tem((i + 1)))
Image.ImageUrl = details(1).ToSt ring
lblLastChecked. Text = details(3).ToSt ring
RatedImage.Imag eUrl = detailsAfterRat ing(2).ToString
lblRating.Text = detailsAfterRat ing(5).ToString
lblPastRate.Tex t = Session("youRat ed")
i = (i + 1)
Session.Add("i" , i)
'details.Clear( )
'detailsAfterRa ting.Clear()
leftPanel.Visib le = True
Else
Response.Redire ct("Homepage.as px")
End If
End If
End Sub
'This works fine, but only after the page_load. So the first time is
ok, but the second time I need it to be clear and to do something
before it goes to page_load again.
Protected Sub RadioButtonList 1_SelectedIndex Changed(ByVal sender
As System.Object, ByVal e As System.EventArg s) Handles
RadioButtonList 1.SelectedIndex Changed
Dim answer As String
answer = RadioButtonList 1.SelectedValue .ToString
'Code for inserting into database...
End Sub
Tks for all the help.
On Mar 29, 11:24 pm, ricardo.sobral. san...@googlema il.com wrote:
Hello,
I am trying to get the value of the radiobuttonlist . The problem is
that I need it to be unselected at every page load. The
radiobuttonlist is set to autopostback (true).
My idea is simple. When I select a value, I get it, insert something
into the database with that value and the page loads again with
different data. Imagine a questionnaire and every page load a random
question would be load on screen and when the user clicks the
radiobutton list, I get the value, insert into the database and only
after I do the page_load again. Is there any way of doing this without
a button, and setting the selecteditemcha nged to fire first then the
page_load?
Tks for the help.
The code is simple!
'My Page load is working just the way I want it!
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
If Not Page.IsPostBack Then
RadioButtonList 1.ClearSelectio n() ' I need it to be clear
each time!
leftPanel.Visib le = False
Dim users As New ArrayList
users = User_.ArrayOfUs ers
Session.Add("us ers", users)
Session.Add("i" , 0)
i = 0
details = User_.getQuesti ons(users.Item( i))
Image.ImageUrl = details(1).ToSt ring
lblLastChecked. Text = details(3).ToSt ring
details.Clear()
'users.Clear()
Else
'RadioButtonLis t1.ClearSelecti on()
i = CType(Session(" i"), Integer)
Dim users_tmp As ArrayList
users_tmp = CType(Session(" users"), ArrayList)
If (i < users_tmp.Count - 1) Then
detailsAfterRat ing =
User_.getQuesti ons(users_tmp.I tem(i))
details = User_.getQuesti ons(users_tmp.I tem((i + 1)))
Image.ImageUrl = details(1).ToSt ring
lblLastChecked. Text = details(3).ToSt ring
RatedImage.Imag eUrl = detailsAfterRat ing(2).ToString
lblRating.Text = detailsAfterRat ing(5).ToString
lblPastRate.Tex t = Session("youRat ed")
i = (i + 1)
Session.Add("i" , i)
'details.Clear( )
'detailsAfterRa ting.Clear()
leftPanel.Visib le = True
Else
Response.Redire ct("Homepage.as px")
End If
End If
End Sub
'This works fine, but only after the page_load. So the first time is
ok, but the second time I need it to be clear and to do something
before it goes to page_load again.
Protected Sub RadioButtonList 1_SelectedIndex Changed(ByVal sender
As System.Object, ByVal e As System.EventArg s) Handles
RadioButtonList 1.SelectedIndex Changed
Dim answer As String
answer = RadioButtonList 1.SelectedValue .ToString
'Code for inserting into database...
End Sub
Tks for all the help.
Simply redesign it a little bit, as per
Sub Page_Load(...)
If Not Page.IsPostBack Then
LoadNewQuestion ()
End If
End Sub
Sub RadioButtonList 1_SelectedIndex Changed
'Code for inserting into database...
......
LoadNewQuestion ()
End Sub
Sub LoadNewQuestion ()
RadioButtonList 1.ClearSelectio n()
' Loading new question
.......
End Sub This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: KathyB |
last post by:
Hi,
On Page Load (if not postback), the user selects a choice from
dropdownlist1.
On SelectedItemChanged for dropdownlist1, dropdownlist2 is populated
and the user selects an item.
I cannot find a combination where I can RETAIN both values during
postback...if I put if not posback on the change event of
|
by: William LaMartin |
last post by:
If I create a RadioButtonList with, say, two items, then after the page
loads and I select one of the items and then click on a button whose click
event contains some code to display the RadioButtonlList's selected value,
there is nothing.
On a postback, with the dynamically created button list visible on the page
and the first item selected, if I try some code like "If
Me.RadioButtonList1.Items(0).Selected = True Then.......", then I...
|
by: Niks |
last post by:
Hi,
I am creating a simple .aspx page to add some fields with validation.
I have used different .NET validations like REquiredFieldValidator,
RegularExpressionValidator and showed the summary in the bulleted list
on top. I have 3 text boxes, and two RadioButtonList. and 3 buttons.
One for Submit, Reset and Exit.
If submit is pressed page should be validated and submit (insert into
|
by: Arun K |
last post by:
Hi,
I am creating a simple .aspx page to add some fields with validation.
I have used different .NET validations like REquiredFieldValidator,
RegularExpressionValidator and showed the summary in the bulleted list
on top. I have 3 text boxes, and two RadioButtonList. and 3 buttons. One
for Submit, Reset and Exit.
If submit is pressed page should be validated and submit (insert into
|
by: Goober at christianDOTnet |
last post by:
I'm wanting to fix the following on a web page without really re-inventing
anything.
What I have is a vb web page with a radiobuttonlist where I can pick Current
or History year.
Underneath that is a listbox that has a set of reports in it, some for
current year, some for history year. If Current year is chosen, 6 reports
(depending on user access level) are listed, on the History one, 2 are
listed (also depending on user access...
| |
by: jmgro |
last post by:
I have spent way too much time trying to solve the following problem:
I have a datalist with a timer in the footer template. It works wonderfully
except when the user pages back, then forward, and the counter is reset. I
saw in one of Kevin Spencer's comments not to put the timer in javascript on
the load function, but I have to get the script to run before the page is
rendered, otherwise my timer is not displayed. I have a flag "Hidden...
|
by: chaz |
last post by:
here is the html :
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="<%=LABEL_WIDTH%>" class="formtext"><%= HTEXT("Connection
type:")%></td>
<td class="formtext">
<input type="radio" class="inputRadio" id="dbStatus" name="dbStatus"
value="1" onclick="changeDbStatus(1)" <%if dbStatus=1 then%checked
|
by: Gummy |
last post by:
Hello,
I created a user control that has a ListBox and a RadioButtonList (and other
stuff). The idea is that I put the user control on the ASPX page multiple
times and each user control will load with different data (locations,
departments, etc.).
|
by: Jeffrey Walton |
last post by:
Hi All,
Sorry about this beginner question (I'm coming up from Visual C++ or
Down from VB)... Also, pickings are slim for this topic on MSDN . does not really apply, but it was a keyword hit
("SelectedItemChanged"). Does any one know how to receive this
notification? I'm not receiving it.
What I done so far: Hightlight the TreeView in Design Mode, and then
switching to Properties->Events: SelectedItemChanged is not an
available...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| | |