Asp.net String Not Retained On Postback?

Nov 9, 2010

A user logs in by inserting their user id and password.If they don't have an email address assigned to their login details they are asked to submit one before they can continue.They then continue to the home page in a logged in state.The trouble I'm having is that the user id and password are not retained when they submit their email address so the login fails.

Here's the code...

Dim userid as String
Dim password as String
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)

[code]....

View 1 Replies


ADVERTISEMENT

Decimal Values Are Being Retained?

Sep 27, 2010

I have two functions that return a dollar amount but one of the amounts extends out to more than 2 decimal positions. So I'm trying to round it to two decimal positions and for some reason after the amounts are added together it goes back to extending out more than 2 decimals. I have tried several things. Currently I'm trying to even use a string variable in-between conversions to see if I can get rid of the decimal values but it's still not working.

Here is the first function.

Public Function dTotalDollars(Optional ByVal iClassAccountIndex As Short = -1, _
Optional ByVal iBreakdownCode As DOLLAR_AMOUNT = DOLLAR_AMOUNT.ALL_DOLLARS) As Double
Dim dAmount As Double

[Code].....

Then after the second call it's showing in debug mode that dTotalCalcDollars is going to return 2272.37, but once it adds it to dAmount the amount becomes 28094.739999999998 instead of 28094.74.

View 4 Replies

Focus Retained From One Datagridview To Another?

Jan 24, 2011

I can enter data into the grid and have an working update command when the row leave event occursProblem comes when I click into the other datagridview the previous cell in the previous datagridview highlights and the cell in the datagrid view I click on highlights I can edit data in the other datagrid view but as long as that highlight is on in theprevious datagridview I cannot shut down my program with the close button. I must first go back to that other datagrid view and click on it once to lose that highlighted cell and then close. I don't get any errors during this time just can't shut down program.

View 7 Replies

Fields Updated In DGV But No Record Retained

Jan 28, 2009

I have VB.Net Exp 2008 with SQL Exp 2008, on a windows form I have 6 databound textboxes and 6 unbound textboxes, in the bound textboxes the records show as the bound dataGridView rows are selected, in the unbound textboxes is where I will enter the new record to be sent to the database. Added an SQL database in the designer which gave me a dataset(MdDB1DataSet) and a tableAdapter(MdTBTableAdapter). My problem is with adding, updating and deleting records. The add records button addes it during debug to the dataGridView, but does not return when I debug again. So this means it is not added to the database. The update button updates the fields in the DGV, but no record was retained.

Add Record button:
Dim nr As DataRow = MdDB1DataSet.Tables(mdTb).NewRow
nr(0) = Trim(txtAdd1.Text)
nr(1) = Trim(txtAdd2.Text)
nr(2) = Trim(txtAdd3.Text)
nr(3) = Trim(txtAdd4.Text)
[Code] .....

View 12 Replies

.net - ASP.NET Keep Fileupload After Postback?

Jul 13, 2010

I'm writing an intranet ASP.NET page using VB.NET. I've run into a particularly nasty problem dealing with handling file uploads. I'll do my best to explain the problem, and perhaps someone can help.

My problem is almost a duplicate of this one, or this one, except (other than the filename) I don't care about sending the file to the server until the other data has been reviewed. here's the situation:

Joe Q. Dataentry inputs some data into several fields. The first 3 are drop down, and when he changes the selection, a postback event is fired that queries a database for valid entries for the other drop down selections. After selecting the values, he inputs some other data, chooses a file to accompany the data and clicks the "Update" button. When he hits the button, it fires a postback event that sends the current data to the server to be validated. The data will create a change in the database, so he is presented with a view of the current state, and what it will look like when his changes are made. He can now either confirm or cancel the operation for whatever reason.

Part of the data he will see involves the extension of the file which may be a PDF, or could also be some image file or other document.

Now here's where my problem is - on each postback event, the fileupload dialog is cleared. I was getting around it by creating a temporary file on the first postback and then renaming if he clicks OK or deleting on Cancel... but I need to do a variety of things, based on the previous state of data and the filename. I've tried to keep some session variables to retain the filename, and that works OK for just renaming the file, but for what I need to do it gets unwieldy.

What I want to do is be able to have the postback event to present the changes, and then when the user clicks "OK", submit the file. Is there any possible way to do that?

One of my thoughts was to do some of the validation client-side (I'm already re-validating server side so I'm not too worried about data security there), but I don't know how I could get the information from the database query. It appears that what I want to do is prevent a certain button from firing a full postback. Is there any way to do that?I have an update panel on the page already - is there any way for the button to only post what's in the update panel?

View 1 Replies

Asp.net - Get Value Of Listitem On Postback

Nov 11, 2010

I have two listitems and the postback and run a function.

[Code]....

View 1 Replies

ASP.Net Menu On Postback?

Feb 22, 2012

I have the Menu Control in Visual Studio 2010 is set up horizontal in my Master page but on same pages when the page loads and on postback with datasources that take a few seconds to return data the menu spreads vertically down the page. How can I fix this problem?

View 1 Replies

Force An ASP Page To Postback?

Feb 18, 2009

I've got a handful of dynamic controls populating an ASP page, with VB.NET in the back-end.What I need is when the user changes the .TEXT value of a textbox and the page posts back, the .TEXT value of a Table Cell changes to reflect that change (it multiplies the value of the textbox by the value of another cell).But a Table Cell can't be set to AutoPostBack, and I can't for the life of me figure out how to programmatically refresh the page (force a postback) in the TextChanged event for the textbox.

View 1 Replies

.net - Usercontrol And Page Postback?

Aug 8, 2011

I have a page with three radio buttons and a calendar usercontrol. The radio buttons have autopostback and depending on which one you click it should change the calendar availabilities based on the selected index.The problem is that the page load of the calendar is executing first before the selected index change (where I am setting the needed id).

View 1 Replies

Asp.net - View State After Postback VB?

Apr 12, 2011

I have a label's value that is posted back from a previous page and I want to use this label to do a simple calculation in the current page, but when I do the calculation the page (refreshed) the value of this label and automatically deleted the value (Since there would be no value in postback when it refreshed).

Here is the code behind file:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Label2.Text = Request.Form("Hidden1")
End Sub

and here where I want to use the label

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Stotal As String
Stotal = Val(Label2.Text) * 10
Label3.Text = Stotal
End Sub

How can I save the value in the page via view state or any other method?

View 1 Replies

Do Postback Dynamically In Program?

Jun 4, 2012

Is it possible to do postback dynamically in vb.net or c#.net?

THere is a asp button (let say buttonA) if i click buttonA it has to do some actions and then trigger postback

postback should not be triggered onclicking a button . only after performing some actions it has to trigger postback

View 4 Replies

Dynamic UserControls On PostBack Asp.Net?

Sep 12, 2011

I created an item user_control that has a textbox, button, etc. which will intentionally collect the total quantity of items the user wants.

I dynamically create a few intances of user_control on page_load. If you click the add button for the item quantity it will add to a session variable. however when the user enters a different quantity in the textbox and clicks the add button the total is of the original value of the textbox.

How to get the value the the user has typed in to the textbox to add to total???

I've create a stripped down example below: [UserControl] [Page] [CodeBehind]

UserControl...
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="BomItem.ascx.vb" Inherits="DynamicUserControl.BomItem" %>
<style type="text/css">

[Code].....

View 1 Replies

How To Make DropdownList No Postback

Sep 12, 2011

How can I make dropdownlist no postback - I have a dropdownlist which I put a code in selected indexchanged - basically for every indexchanged the code will connect to sql and get values then populate textboxes with values.

Here is my code
<asp:DropDownList ID="ddlSalesOrg" runat="server" Style="width: 200px;"
AutoPostBack="true" />

Obviously when I remove the autopostback="true" - then indexchanged will not function as expected.

View 2 Replies

Javascript - Keep Div Visible On Postback?

Feb 22, 2011

I have a div which needs to be hidden when the page first loads. If the user then clicks the "btnShowDiv" button, it should then become visible.The problem I have is that, once it has become visible I need it to stay visible. At the moment, whenever I click on an asp button the div reloads and becomes hidden again.

<DIV id="myDiv" style="display:none;">
<label>some text</label>
</DIV>[code].....

View 2 Replies

Keep The Values Of Checkboxes After Postback?

Feb 29, 2012

I have a checkbox in datalist, after the button is clicked(postback) the value of checkbox is cleared. For example, if the checkbox in datalist is checked, when the button is clicked the checkbox appears unchecked when getting it's value

View 2 Replies

Populating Data On Postback?

Jun 8, 2012

I would like to know if i had two columns from a database called SellerID and Product letter in a table called product, and on a new form i want to be able to combine the columns i.e if the user enters the sellerId and product ID e.g 1A in a SellerProductID in a new table on a new for i want the program to do a postback and have the Description Field be populated with the data from the Products ID Therefore the SellerID + Product letter = SellerProductID and it should select the description in the description field.

View 2 Replies

Preserving Variables Through Postback?

Mar 7, 2011

I'm creating a Website and I noticed that when the page reloads due to a postback, My variables all are unloaded so I have a Null variable,

For Example I'd Declare a String With an initial value of "" then later in the code set it to "Some Value", when a button is clicked to cause a postback, this value then becomes "" again

Is there some way to preserve variable so their values remain the same after a postback

View 4 Replies

Re-Adding Handler On Every Postback

Jun 8, 2011

When the page is loaded the following code is invoke
Page load
Dim products As New LinkButton
Products.Text = "Products"
testPanel.Controls.Add(products)
AddHandler products.Click, AddressOf getProducts
[Code] ......

What I want to achieve when the page load I link is create Products when i click on products link it invoke an event handler call getProducts. Getproducts will loop in the database to fetch all record then it will create a link for each product name when i click on the product name it should invoke another event. My problem is how can I re add control after every postback.

View 1 Replies

Reference A Textbox Value Without Postback?

Jul 15, 2011

I have a child aspx page in an iFrame. There are a few textboxes, which are populated in the page load event.

There is also a LinkButton which the user clicks when s/he is finished editing the fields. There are some javascript functions and other things going on, so a full postback (ie: asp button) is out of the question.

Problem is, I need to reference the textboxes NEW values (user changes) after the linkbutton is clicked.

After playing with the interface a bit further, I realized the Page_Load event was firing as soon as the LinkButton was clicked. Of course this is where the data is initially loaded, so any changes the user made is immediately written over. Current plan of attack is to create an IsLoaded cookie value and check if true before the mentioned code executes.

View 2 Replies

Show Alert After Postback?

Sep 25, 2011

I have a button which calls stored procedure and binds gridview.I found a code on stackoverflow for top alert bar like this:

[Code]...

View 1 Replies

Stop GridView From Postback?

Mar 10, 2009

on my aspx page I have 4 dropdowns and a gridview.Each dropdown is populated based on previous dropdown selection (each of the dropdowns are autopostback=true)and the grid suppose to display data when all dropdowns are selected. The bad thing is that the grid gets repopulated whenever any of the dropdown selected.So when a user select first dropdown, the grid displays data, then it repopulated again on second dropdown postback and so on...I would like to have a user to select all values in dropdowns and after that on a click of a button show the datagrid.How do I do that?

View 2 Replies

Viewstate Does Not Persist After Postback

Mar 21, 2012

I'm having some problems in persisting the viewstate on postback for a Control (vb.net)

here's some code i've put in my control[code]...

I'm setting EnableViewState = "true" everywhere i can, but still no result. Do i really need to set those properties here. (ViewStateMode and EnableViewState) If not, where should i handle this and what is the difference between those properties?

View 4 Replies

.net - Datalist Not Retaining Values On Postback

May 20, 2009

I have a datalist control that is not retaining it values during postback when the control causing the postback is outside of the update panel that the Datalist resides in. I have verified that viewstate is on for that usercontrol as well as all its parent controls. My basic situation is that I have a Datalist that contains a user control on a page. When the user selects several rows in a grid and presses a button, a datatable is filled on the backend and assigned to the Datalist which has its item template set to the UserControl.

On ItemDataBound I set specific properties in the control which customize the messages on that control to the specific item. This is then popped up using the AJAX Control Toolkit Modal Popup[ Extender. When the user presses Save the whole page posts back. Data is collected from the user controls and saved to the DB and the popup disappears. The issue I am currently having is that the DataList has 0 items when the save button is pressed instead of the appropriate number. THis issue just started appearing after we upgraded from .NET 2.0 to .NET 3.5.

View 1 Replies

.net - File-download Prevents Postback?

Nov 27, 2011

I want to generate a (report) file for users to download, then display a message to users to show the process completed successfully.

Dim myFile As FileInfo = New FileInfo(<filepath>)
'My function to generate a report (this can take a few minutes)
GenerateReport(myFile.FullName)

[code].....

View 9 Replies

.net File-download Prevents Postback?

Apr 14, 2011

I want to generate a (report) file for users to download, then display a message to users to show the process completed successfully.

Dim myFile As FileInfo = New FileInfo(<filepath>)
'My function to generate a report (this can take a few minutes)
GenerateReport(myFile.FullName)

[code]....

However, when I use create a "save as" box, it seems to stop the message appearing at all.

View 1 Replies

Asp.net - Dropdownlist Is Cleared On Page Postback

Apr 8, 2011

I have a FormView bound to a SqlDataSource on my page. One of the controls on the FormView is a DropDownList, which gets populated on Page_Load (it's being populated with a list of file names from a specific folder).

Everything goes well when the page first loads. I am able to view the list of files, select one and, upon hitting the "save" button, store the correct filename in the database. However, when the page refreshes after the post back - the DropDownList is empty.

[Code]...

View 1 Replies

Asp.net - ItemCommand Fires Before ItemDataBound On PostBack?

Nov 5, 2011

This is just stupid. I've been at this for over 5 hours and can't figure out why my freaking commands aren't firing properly. The only ones that fire properly are the Built-in commands "Edit" & "Cancel"

<asp:ListView ID="NewProduct" runat="server" DataSourceID="NewProductSDS" DataKeyNames="ID">
<ItemTemplate>
<div>
<asp:LinkButton ID="accept" runat="server" CommandName="Accept" />
<asp:LinkButton ID="edit" runat="server" CommandName="Edit" />

[Code]...

View 1 Replies

Asp.net - Preserving Dynamic UserControl On PostBack?

Feb 5, 2012

I'm dynamically loading User Controls into a div, which I need to preserve on postback in order to call a Save method once the user is done editing them. The div and all the User Controls have the EnableViewState = True.

ASPX Div Declaration

<div id="dynamicDiv" runat="server" enableviewstate="true">
</div>[code]......

So... the controls load fine, but I can't find a way to preserver them on postback, I can't reload them because the user has already input data into the usercontrol (which is what I need to save).

P.S. I tried adding them to a list and then adding the list to the ViewState, but I haven't been able to properly serialize the control. I implemented ISerializable for the userControl's code behind but then it says the ASCX is mot marked as serializable with

Type 'ASP.controls_userControlType_ascx' in Assembly 'App_Web_pn5vxhpw, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

View 2 Replies

Asp.net - RadGrid Doesn't Update After Postback

Oct 24, 2011

I'm doing a form to add/edit/delete values from a data catalog. everything goes fine but the Radgrid doesn't update after Submit Button is pressed in the edit/new dialog. i did it before in a more complex form but i can't figure exactly what's wrong.

in the update the data where the new data will be overwritten dissapears after postback. (i have a way to solve this)

mnlib is a library of my authorship to deal with common tasks i know that queries with strings like {$database_name} is not a standart practice, and probably is not recomended, but i have to deal with it . i'm doing almost everything programatically some of the code is ommited because character limit in post Updated: Reduced code, i'm afraid if keep reducing code, i will eventually delete something important to the iusse

ASPX file

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Templates/2Cols.Master" CodeBehind="lstCat.aspx.vb" Inherits="adquisicioneNET.lstCat" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

[Code]....

View 1 Replies

Asp.net - Textbox Values Disappear On Postback?

May 11, 2012

I have an asp.net page with a button that adds an additional row to a gridview for input to the database. The gridview consists of 3 textboxes(template fields), when I add a row the information already entered somehow disappears on the postback. I want the button to add additional rows without disspelling the data in the other rows, until I hit the submit button. Here's my code

Private Sub AddNewRowToGrid()
Dim rowIndex As Integer = 0
If ViewState("CurrentTable") IsNot Nothing Then

[Code].....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved