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.
|
|
|
|
|
![]() |
||
Question about buttons and Autopostback
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
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 |
|
|
|
|||
|
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. |
|
|||
|
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. |
![]() |
| Tags |
| question, buttons, autopostback |
| Thread Tools | |
|
|
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 |