Wednesday, March 28, 2012
Tri-State Check Box
checked-always on, or 1-run once)
Would I be correct in assuming the best way to do this is to make some kind
of custom control that displays a "checkbox". The control would have JS in
it to change a graphic image that represents the box. If this is the case,
how would I read in the selected value once the form is posted? I'm
planning on having a couple on the same form and I really don't want to
autopost when each box is clicked on...too much overhead...
Thanks.
-Rob T.Use the JS to set a hidden field with an appropriate value.
-Cam
Rob T wrote:
> I need to make a tri-state check box. (It's values will be off,
> checked-always on, or 1-run once)
> Would I be correct in assuming the best way to do this is to make some kin
d
> of custom control that displays a "checkbox". The control would have JS i
n
> it to change a graphic image that represents the box. If this is the case
,
> how would I read in the selected value once the form is posted? I'm
> planning on having a couple on the same form and I really don't want to
> autopost when each box is clicked on...too much overhead...
> Thanks.
> -Rob T.
>
Good idea...I could program the control to create a hidden field (with a
unique ID) for each checkbox...then just have a little routine to loop
through all the Request.Form items...
Thanks.
"cameron" <cameron.charlebois@.appdepot.com> wrote in message
news:OnL1UKmTEHA.3844@.TK2MSFTNGP11.phx.gbl...
> Use the JS to set a hidden field with an appropriate value.
> -Cam
> Rob T wrote:
>
kind
in
case,
Tri-State Check Box
checked-always on, or 1-run once)
Would I be correct in assuming the best way to do this is to make some kind
of custom control that displays a "checkbox". The control would have JS in
it to change a graphic image that represents the box. If this is the case,
how would I read in the selected value once the form is posted? I'm
planning on having a couple on the same form and I really don't want to
autopost when each box is clicked on...too much overhead...
Thanks.
-Rob T.Use the JS to set a hidden field with an appropriate value.
-Cam
Rob T wrote:
> I need to make a tri-state check box. (It's values will be off,
> checked-always on, or 1-run once)
> Would I be correct in assuming the best way to do this is to make some kind
> of custom control that displays a "checkbox". The control would have JS in
> it to change a graphic image that represents the box. If this is the case,
> how would I read in the selected value once the form is posted? I'm
> planning on having a couple on the same form and I really don't want to
> autopost when each box is clicked on...too much overhead...
> Thanks.
> -Rob T.
>
Good idea...I could program the control to create a hidden field (with a
unique ID) for each checkbox...then just have a little routine to loop
through all the Request.Form items...
Thanks.
"cameron" <cameron.charlebois@.appdepot.com> wrote in message
news:OnL1UKmTEHA.3844@.TK2MSFTNGP11.phx.gbl...
> Use the JS to set a hidden field with an appropriate value.
> -Cam
> Rob T wrote:
> > I need to make a tri-state check box. (It's values will be off,
> > checked-always on, or 1-run once)
> > Would I be correct in assuming the best way to do this is to make some
kind
> > of custom control that displays a "checkbox". The control would have JS
in
> > it to change a graphic image that represents the box. If this is the
case,
> > how would I read in the selected value once the form is posted? I'm
> > planning on having a couple on the same form and I really don't want to
> > autopost when each box is clicked on...too much overhead...
> > Thanks.
> > -Rob T.
Monday, March 26, 2012
Trouble posting to Database from Drop Down List and Text box
When I type in some text information, no other characters but plane text, and hit the submit button the text disappears from the box, the drop downlist returns to default, the subroutine runs and an empty space is submitted to the database.
I've verified that the procedure in my namespace is running correctly by allowing the subroutine in the code behind to trigger the SPROC in the namespace. The 'hardcoded' values are inserted into the database.
I also placed a label.text = textbox.text into the subroutine and it is always set to a blank. Even on page intialization. None the less, I wanted to see if running the subroutine would place text inside of the label and it didn't. If I hard code the label, such as label.text = "stanley" then stanley appears when you click the link button. Thus, I'm sure that the subroutine is running, its appears that the text in the text box is being lost when the page makes a round trip.
Any ideas?
SethLet's see your code.
Be sure that you are wrapping any code that initializes the values textbox and dropdownlist in your Page_Load with a check for IsPostBack:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
'Initialize initial values of textbox and dropdownlist here
End If
End Sub
If you don't, each time the page postsback, the controls will be reset back to their initial state, probably blank for the textbox and no selected item for the drop down list. Remember that when the page posts back, Page_Load will run BEFORE any of the web control event handlers.
Saturday, March 24, 2012
Trouble updating
Sub LoadInventory()
Connect()
Dim strQuery As String = "SELECT Type, Number FROM Inventory WHERE type = 'squares'"
Dim dbComm As New OLEDBCommand(strQuery, objConnection)
Dim reader As OLEDBDataReader = dbComm.ExecuteReader()
reader.Read()
txtAmount.Text = reader.GetString(1)
reader.Close()
Disconnect()
End Sub
Sub btnChange_Click(ByVal Sender As Object, ByVal E As EventArgs)
UpdateInventory()
LoadInventory()
End Sub
Private Sub UpdateInventory()
Dim strSQL As String = "UPDATE Inventory SET Number = " & txtAmount.Text & " WHERE Type = 'squares'"
Connect()
Dim dbComm As New OLEDBCommand(strSQL, objConnection)
dbComm.ExecuteNonQuery()
Disconnect()
End Subinstead of
Dim strSQL As String = "UPDATE Inventory SET Number = " & txtAmount.Text & " WHERE Type = 'squares'"
try this
Dim strSQL As String = "UPDATE Inventory SET Number = " & Convert.ToInt32(txtAmount.Text) & " WHERE Type = 'squares'"
Jeff
Jeff,
Thanks for your reply. That however didn't work. Could it be the way I have my access database setup?
Jeremy
Jeff,
Does it work when you try putting in a static value for txtAmount.Text such as this:
"UPDATE Inventory SET Number =1 WHERE Type='squares'"
If it does work like that, then try doing this:
Try
Dim dbComm As New OLEDBCommand(strSQL, objConnection)
dbComm.ExecuteNonQuery()
Catch dbException As Exception
Response.Write(dbException.ToString())
End Try
Tell us what the exception is. Besides, it is always good practice anyway to put database queries inside a try statement - there are just way too many things that could go wrong to not catch those errors.
Aaron
Thursday, March 22, 2012
Trouble With Session State
I am having trouble with session state in my asp.net 1.1 C# web app. I
am trying to program either a popup box warning of expiration, or I
may do a redirect to the home page upon expiration.
But I can't seem to get started, because I am getting values that I do
not understand. In IIS settings, I stopped my website/app and went
into the properties for it and selected the "Home Directory" tab. Then
I clicked the "Configuration" button and selected the "Options" tab.
Then under the "Application Configuration" group, I verified that the
box for "Enable session state" was checked. Then I changed the value
to "2" (just for testing). I then saved and restarted my website.
Then I opened the site in Visual Studio.net and went into the
web.config file and changed the forms authentication timeout value to
"1" (again, just for testing).
Then when I ran my code, in debug mode/step through, I can see that
the value being returned for "this.Session.Timeout" is "15"? What's
going on here? I thought that when I set the value in IIS, it would
make it 2, but that didn't happen? Where is this number coming from?
How can I change/control it?
Your help is much appreciated.
JP"Joey" <joey.powell@.topscene.com> wrote in message
news:1176914556.144456.278850@.b75g2000hsg.googlegroups.com...
> Hello,
> I am having trouble with session state in my asp.net 1.1 C# web app. I
> am trying to program either a popup box warning of expiration, or I
> may do a redirect to the home page upon expiration.
> But I can't seem to get started, because I am getting values that I do
> not understand. In IIS settings, I stopped my website/app and went
> into the properties for it and selected the "Home Directory" tab. Then
> I clicked the "Configuration" button and selected the "Options" tab.
> Then under the "Application Configuration" group, I verified that the
> box for "Enable session state" was checked. Then I changed the value
> to "2" (just for testing). I then saved and restarted my website.
I believe these values are for classic ASP, not for ASP.NET.
--
John Saunders [MVP]
On Apr 18, 12:34 pm, "John Saunders [MVP]" <john.saunders at
trizetto.com> wrote:
> "Joey" <joey.pow...@.topscene.com> wrote in message
> news:1176914556.144456.278850@.b75g2000hsg.googlegroups.com...
>
>
>
> I believe these values are for classic ASP, not for ASP.NET.
> --
> John Saunders [MVP]
So how does one set session timeout for asp.net?
Use the sessionState entry in Web.Config...
--
Brad
"Software is like melted pudding..."
"Joey" wrote:
> On Apr 18, 12:34 pm, "John Saunders [MVP]" <john.saunders at
> trizetto.com> wrote:
> So how does one set session timeout for asp.net?
>
On Apr 18, 12:54 pm, Brad Roberts <BradRoberts56noj...@.hotmail.com>
wrote:
> Use the sessionState entry in Web.Config...
> --
> Brad
> "Software is like melted pudding..."
>
> "Joey" wrote:
>
>
>
>
>
>
>
> - Show quoted text -
Thanks
Tuesday, March 13, 2012
Trouble With Session State
I am having trouble with session state in my asp.net 1.1 C# web app. I
am trying to program either a popup box warning of expiration, or I
may do a redirect to the home page upon expiration.
But I can't seem to get started, because I am getting values that I do
not understand. In IIS settings, I stopped my website/app and went
into the properties for it and selected the "Home Directory" tab. Then
I clicked the "Configuration" button and selected the "Options" tab.
Then under the "Application Configuration" group, I verified that the
box for "Enable session state" was checked. Then I changed the value
to "2" (just for testing). I then saved and restarted my website.
Then I opened the site in Visual Studio.net and went into the
web.config file and changed the forms authentication timeout value to
"1" (again, just for testing).
Then when I ran my code, in debug mode/step through, I can see that
the value being returned for "this.Session.Timeout" is "15"? What's
going on here? I thought that when I set the value in IIS, it would
make it 2, but that didn't happen? Where is this number coming from?
How can I change/control it?
Your help is much appreciated.
JP"Joey" <joey.powell@.topscene.comwrote in message
news:1176914556.144456.278850@.b75g2000hsg.googlegr oups.com...
Quote:
Originally Posted by
Hello,
>
I am having trouble with session state in my asp.net 1.1 C# web app. I
am trying to program either a popup box warning of expiration, or I
may do a redirect to the home page upon expiration.
>
But I can't seem to get started, because I am getting values that I do
not understand. In IIS settings, I stopped my website/app and went
into the properties for it and selected the "Home Directory" tab. Then
I clicked the "Configuration" button and selected the "Options" tab.
Then under the "Application Configuration" group, I verified that the
box for "Enable session state" was checked. Then I changed the value
to "2" (just for testing). I then saved and restarted my website.
I believe these values are for classic ASP, not for ASP.NET.
--
John Saunders [MVP]
On Apr 18, 12:34 pm, "John Saunders [MVP]" <john.saunders at
trizetto.comwrote:
Quote:
Originally Posted by
"Joey" <joey.pow...@.topscene.comwrote in message
>
news:1176914556.144456.278850@.b75g2000hsg.googlegr oups.com...
>
Quote:
Originally Posted by
Hello,
>
Quote:
Originally Posted by
I am having trouble with session state in my asp.net 1.1 C# web app. I
am trying to program either a popup box warning of expiration, or I
may do a redirect to the home page upon expiration.
>
Quote:
Originally Posted by
But I can't seem to get started, because I am getting values that I do
not understand. In IIS settings, I stopped my website/app and went
into the properties for it and selected the "Home Directory" tab. Then
I clicked the "Configuration" button and selected the "Options" tab.
Then under the "Application Configuration" group, I verified that the
box for "Enable session state" was checked. Then I changed the value
to "2" (just for testing). I then saved and restarted my website.
>
I believe these values are for classic ASP, not for ASP.NET.
--
>
John Saunders [MVP]
So how does one set session timeout for asp.net?
Use the sessionState entry in Web.Config...
--
Brad
"Software is like melted pudding..."
"Joey" wrote:
Quote:
Originally Posted by
On Apr 18, 12:34 pm, "John Saunders [MVP]" <john.saunders at
trizetto.comwrote:
Quote:
Originally Posted by
"Joey" <joey.pow...@.topscene.comwrote in message
news:1176914556.144456.278850@.b75g2000hsg.googlegr oups.com...
Quote:
Originally Posted by
Hello,
Quote:
Originally Posted by
I am having trouble with session state in my asp.net 1.1 C# web app. I
am trying to program either a popup box warning of expiration, or I
may do a redirect to the home page upon expiration.
Quote:
Originally Posted by
But I can't seem to get started, because I am getting values that I do
not understand. In IIS settings, I stopped my website/app and went
into the properties for it and selected the "Home Directory" tab. Then
I clicked the "Configuration" button and selected the "Options" tab.
Then under the "Application Configuration" group, I verified that the
box for "Enable session state" was checked. Then I changed the value
to "2" (just for testing). I then saved and restarted my website.
I believe these values are for classic ASP, not for ASP.NET.
--
John Saunders [MVP]
>
So how does one set session timeout for asp.net?
>
>
On Apr 18, 12:54 pm, Brad Roberts <BradRoberts56noj...@.hotmail.com>
wrote:
Quote:
Originally Posted by
Use the sessionState entry in Web.Config...
--
Brad
>
"Software is like melted pudding..."
>
>
>
"Joey" wrote:
Quote:
Originally Posted by
On Apr 18, 12:34 pm, "John Saunders [MVP]" <john.saunders at
trizetto.comwrote:
Quote:
Originally Posted by
"Joey" <joey.pow...@.topscene.comwrote in message
>
Quote:
Originally Posted by
Quote:
Originally Posted by
>news:1176914556.144456.278850@.b75g2000hsg.googlegr oups.com...
>
Quote:
Originally Posted by
Quote:
Originally Posted by
Hello,
>
Quote:
Originally Posted by
Quote:
Originally Posted by
I am having trouble with session state in my asp.net 1.1 C# web app. I
am trying to program either a popup box warning of expiration, or I
may do a redirect to the home page upon expiration.
>
Quote:
Originally Posted by
Quote:
Originally Posted by
But I can't seem to get started, because I am getting values that I do
not understand. In IIS settings, I stopped my website/app and went
into the properties for it and selected the "Home Directory" tab. Then
I clicked the "Configuration" button and selected the "Options" tab.
Then under the "Application Configuration" group, I verified that the
box for "Enable session state" was checked. Then I changed the value
to "2" (just for testing). I then saved and restarted my website.
>
Quote:
Originally Posted by
Quote:
Originally Posted by
I believe these values are for classic ASP, not for ASP.NET.
--
>
Quote:
Originally Posted by
Quote:
Originally Posted by
John Saunders [MVP]
>
Quote:
Originally Posted by
So how does one set session timeout for asp.net?- Hide quoted text -
>
- Show quoted text -
Thanks