473,387 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Having 2 SUBMIT_CLICK buttons on a page?

I have a a control survey box e.g

<VTS:SURVEYBOX id="SurveyPreview" runat="server" Surveyid="1"
Width="700" BackColor="White" CellSpacing="0" CellPadding="0"
EnableValidation="true" BorderWidth="1px" BorderColor="#E0E0E0"
Font-Names="Arial" Font-Size="10pt">
</VTS:SURVEYBOX>

And it already has a submit button that users use to submit
data to the database when they finnish filling the SURVEY.
But i want to add a function that when they click on the SUBMIT button i
want to capture the LOGON_USER filling the SURVEY and add it to the
database.
Because i want to check each user after clicking the SUBMIT if they have
filled it before if they have then i want to return access denied or
survey alread filled!
Any ideas!!!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #1
2 982
Why not just pass a cookie when they click Submit to indicate they've done
the survey. Just check for the cookie when the page loads and disable the
Submit button if they've done it.

No pointing letting people fill out a survey if they're just going to be
told they aren't allowed to do it again.

"Patrick Olurotimi Ige" <ig*@iprimus.com.au> wrote in message
news:up**************@TK2MSFTNGP10.phx.gbl...
I have a a control survey box e.g

<VTS:SURVEYBOX id="SurveyPreview" runat="server" Surveyid="1"
Width="700" BackColor="White" CellSpacing="0" CellPadding="0"
EnableValidation="true" BorderWidth="1px" BorderColor="#E0E0E0"
Font-Names="Arial" Font-Size="10pt">
</VTS:SURVEYBOX>

And it already has a submit button that users use to submit
data to the database when they finnish filling the SURVEY.
But i want to add a function that when they click on the SUBMIT button i
want to capture the LOGON_USER filling the SURVEY and add it to the
database.
Because i want to check each user after clicking the SUBMIT if they have
filled it before if they have then i want to return access denied or
survey alread filled!
Any ideas!!!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 19 '05 #2
Thx Ken
I was thinking of cookie and i know it could have been the best options.
But it won't work for them because u have multiple user to one PC!
By the way 'm having a problem when i'm checking the user in the DB.When
i load the page 'm always getting the ACCESS DENIED PAGE..which seems it
inserts the USER before checking.

Am i missing something??

My SProcedure and my ASP.NET below :-

CREATE procedure oyinbo(@username varchar(50) ) as
if exists
-- You cannot register usernames already registered on the database
twice.
(
select username from survey where username = @username
)
--insert survey(username,DateCreated) values(@username,getdate())
return 1 else
insert survey(username,DateCreated) values(@username,getdate())
GO
AND MY ASP.NET CODE:-
Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

conn = New
SqlConnection("server=(local);database=Wintergreen ;integrated
security=true;")
conn.Open()
txtuser.ID = Request.ServerVariables("LOGON_USER")

cmdcommand = New SqlCommand("sp_checkusers", conn)
cmdcommand.CommandType = CommandType.StoredProcedure
param = cmdcommand.Parameters.Add("ReturnValue", SqlDbType.Int)
param.Direction = ParameterDirection.ReturnValue
cmdcommand.Parameters.Add("@username", txtuser.Name)

cmdcommand.Parameters.Add(New SqlParameter("@DateCreated",
SqlDbType.DateTime, 8))
cmdcommand.Parameters("@DateCreated").Value = Now()

cmdcommand.ExecuteNonQuery()

If cmdcommand.Parameters("ReturnValue").Value = 0 Then

Response.redirect("noaccess.aspx")
' lblMessage.Text = "Username already exists!"

'Else

' lblMessage.Text = "Success!"
REsponse.Redirect("startsurvey.aspx")

End If
conn.Close()
End Sub

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #3

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

Similar topics

1
by: Obi Oberoi | last post by:
I have an ASP.NET application with half a dozen pages most of which have user controls on them (some UC's are loaded dynamically, others are simply dragged and dropped onto the web page) Now,...
3
by: Neo Geshel | last post by:
Question: During the execution of code, which one is looked at first; the Page_Load, or the Submit_Click? My problem arises when I specify a literal in the Page_Load, and attach it to the...
3
by: Neo Geshel | last post by:
Question: During the execution of code, which one is looked at first; the Page_Load, or the Submit_Click? My problem arises when I specify a literal in the Page_Load, and attach it to the...
1
by: =?Utf-8?B?QWxCcnVBbg==?= | last post by:
I have a form containing three AJAX UpdatePanels, two of which contain a pair of listboxes and a pair of buttons, with the third one containing a pair of radio buttons in a radiobutton list and...
0
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,...
0
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$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
0
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,...

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.