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 3984
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: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| | |