Question about buttons and Autopostback

This is a discussion on "Question about buttons and Autopostback" within the ASP.NET Forum section. This forum, and the thread "Question about buttons and Autopostback are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > ASP.NET Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 2nd, 2004, 21:19
Junior Member
Join Date: Jan 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Question about buttons and Autopostback

Hello,
Can anyone tell me what I am missing???
I declare a variable at the module level. I use this variable over and over throughout the page in various functions, etc. I want to write the value of this variable to a database. Well, evidently by default a button is set to autopostback=true. I can't seem to change that. So when I click on my "save report" button, it reposts the page and writes the variable to the database. The problem is since it reposted the page, the variable is empty. What am I doing wrong?

Thanx in advance

  #2 (permalink)  
Old Dec 3rd, 2004, 08:30
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Show me the code you have where you insert the data into the database... are you using Parameters? ...you should have something like this:

cmdUpdate.Parameters.Add(New OleDbParameter("@NewsTitle", NewsTitle.Text))

NewsTitle.Text should be the value of your variable.
  #3 (permalink)  
Old Dec 3rd, 2004, 14:04
Junior Member
Join Date: Jan 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
here is my code in a nutshell:

qrystring = "execute my stored procedure"
MyCommand = New SqlCommand(QryString, "my connection")
open connection
MyCommand.ExecuteNonQuery
close connection

Again, it connects and writes to the DB, the variables are just empty.

Thanks in advance.
  #4 (permalink)  
Old Dec 6th, 2004, 11:13
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
so where are you passing the variables into the stored proceedure?
Closed Thread

Tags
question, buttons, autopostback

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
asp:DropDownList autopostback breepupetstofight ASP.NET Forum 0 Aug 22nd, 2007 14:04
Why are all the buttons at the top? Jellyfishin Webforumz Cafe 6 May 30th, 2007 14:01
help with fwd/backwrd buttons affecting other buttons typeofdoug Flash & Multimedia Forum 5 Feb 4th, 2007 03:48
Question about navigation buttons Lisa81 Web Page Design 8 Sep 3rd, 2006 06:08
CSS Buttons Galaxyblue Web Page Design 29 Feb 13th, 2004 14:02


All times are GMT. The time now is 00:06.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43