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 selecteditemchanged 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.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
RadioButtonList1.ClearSelection() ' I need it to be clear
each time!
leftPanel.Visible = False
Dim users As New ArrayList
users = User_.ArrayOfUsers
Session.Add("users", users)
Session.Add("i", 0)
i = 0
details = User_.getQuestions(users.Item(i))
Image.ImageUrl = details(1).ToString
lblLastChecked.Text = details(3).ToString
details.Clear()
'users.Clear()
Else
'RadioButtonList1.ClearSelection()
i = CType(Session("i"), Integer)
Dim users_tmp As ArrayList
users_tmp = CType(Session("users"), ArrayList)
If (i < users_tmp.Count - 1) Then
detailsAfterRating =
User_.getQuestions(users_tmp.Item(i))
details = User_.getQuestions(users_tmp.Item((i + 1)))
Image.ImageUrl = details(1).ToString
lblLastChecked.Text = details(3).ToString
RatedImage.ImageUrl = detailsAfterRating(2).ToString
lblRating.Text = detailsAfterRating(5).ToString
lblPastRate.Text = Session("youRated")
i = (i + 1)
Session.Add("i", i)
'details.Clear()
'detailsAfterRating.Clear()
leftPanel.Visible = True
Else
Response.Redirect("Homepage.aspx")
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 RadioButtonList1_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
RadioButtonList1.SelectedIndexChanged
Dim answer As String
answer = RadioButtonList1.SelectedValue.ToString
'Code for inserting into database...
End Sub
Tks for all the help. 2 3977
move your page load code to prerender
-- bruce (sqlwork.com) ri*******************@googlemail.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 selecteditemchanged 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.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
RadioButtonList1.ClearSelection() ' I need it to be clear
each time!
leftPanel.Visible = False
Dim users As New ArrayList
users = User_.ArrayOfUsers
Session.Add("users", users)
Session.Add("i", 0)
i = 0
details = User_.getQuestions(users.Item(i))
Image.ImageUrl = details(1).ToString
lblLastChecked.Text = details(3).ToString
details.Clear()
'users.Clear()
Else
'RadioButtonList1.ClearSelection()
i = CType(Session("i"), Integer)
Dim users_tmp As ArrayList
users_tmp = CType(Session("users"), ArrayList)
If (i < users_tmp.Count - 1) Then
detailsAfterRating =
User_.getQuestions(users_tmp.Item(i))
details = User_.getQuestions(users_tmp.Item((i + 1)))
Image.ImageUrl = details(1).ToString
lblLastChecked.Text = details(3).ToString
RatedImage.ImageUrl = detailsAfterRating(2).ToString
lblRating.Text = detailsAfterRating(5).ToString
lblPastRate.Text = Session("youRated")
i = (i + 1)
Session.Add("i", i)
'details.Clear()
'detailsAfterRating.Clear()
leftPanel.Visible = True
Else
Response.Redirect("Homepage.aspx")
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 RadioButtonList1_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
RadioButtonList1.SelectedIndexChanged
Dim answer As String
answer = RadioButtonList1.SelectedValue.ToString
'Code for inserting into database...
End Sub
Tks for all the help.
On Mar 29, 11:24 pm, ricardo.sobral.san...@googlemail.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 selecteditemchanged 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.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
RadioButtonList1.ClearSelection() ' I need it to be clear
each time!
leftPanel.Visible = False
Dim users As New ArrayList
users = User_.ArrayOfUsers
Session.Add("users", users)
Session.Add("i", 0)
i = 0
details = User_.getQuestions(users.Item(i))
Image.ImageUrl = details(1).ToString
lblLastChecked.Text = details(3).ToString
details.Clear()
'users.Clear()
Else
'RadioButtonList1.ClearSelection()
i = CType(Session("i"), Integer)
Dim users_tmp As ArrayList
users_tmp = CType(Session("users"), ArrayList)
If (i < users_tmp.Count - 1) Then
detailsAfterRating =
User_.getQuestions(users_tmp.Item(i))
details = User_.getQuestions(users_tmp.Item((i + 1)))
Image.ImageUrl = details(1).ToString
lblLastChecked.Text = details(3).ToString
RatedImage.ImageUrl = detailsAfterRating(2).ToString
lblRating.Text = detailsAfterRating(5).ToString
lblPastRate.Text = Session("youRated")
i = (i + 1)
Session.Add("i", i)
'details.Clear()
'detailsAfterRating.Clear()
leftPanel.Visible = True
Else
Response.Redirect("Homepage.aspx")
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 RadioButtonList1_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
RadioButtonList1.SelectedIndexChanged
Dim answer As String
answer = RadioButtonList1.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 RadioButtonList1_SelectedIndexChanged
'Code for inserting into database...
......
LoadNewQuestion()
End Sub
Sub LoadNewQuestion()
RadioButtonList1.ClearSelection()
' 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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| | |