C
curtis.lesperance
Hi,
I am using an UpdatePanel that has 2 dropdown menu's in it. I have
one which is the country's that is pulled from an SQL DB and another
that is a list of Province's or States that is pulled from another
table depending on which country is selected. I have an asyncronous
postback trigger that calls my SelectedIndexChanged method to run a
different query depending on what country is selected.
Code Below:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="index.aspx.vb" Inherits="Site_Aform_index" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div style="text-align: center">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />
<br />
<asp:Label ID="lblShipping" runat="server" Font-Bold="True"
Font-Size="Large" Text="Shipping Information" Width="741px"></
asp:Label><br />
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server"
UpdateMode="Conditional">
<ContentTemplate>
<table border="0" cellpadding="3" cellspacing="0"
style="width: 500px" align="center">
<tr>
<td style="width: 152px; text-align: left;"
valign="middle">
<strong>Name:</strong></td>
<td style="width: 84px" valign="middle">
<asp:TextBox ID="txtName" runat="server"
Width="261px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 152px; text-align: left;"
valign="middle">
<strong>Address: </strong>
</td>
<td style="width: 84px" valign="middle">
<asp:TextBox ID="txtStreetAddress"
runat="server" Width="261px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 152px; text-align: left;">
<strong>Phone number.:</strong></td>
<td style="width: 84px">
<asp:TextBox ID="txtPhoneNum" runat="server"
Width="215px"></asp:TextBox>
<asp:RegularExpressionValidator runat="server"
ID="regtxtPhoneNum" ControlToValidate="txtPhoneNum"
ValidationExpression="^[2-9]\d{2}-\d{3}-\d{4}$" Display=Dynamic
ErrorMessage="Please re-enter your phone number as shown"
Width="325px" Height="31px"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td style="width: 152px; text-align: left;"
valign="middle">
<strong>Country:</strong></td>
<td style="width: 84px; text-align: left;"
valign="middle">
<aspropDownList ID="DropDownCountry"
runat="server" AutoPostBack=true
DataSourceID="CountrySqlDataSource"
DataTextField="Country"
DataValueField="CountryID">
</aspropDownList><asp:SqlDataSource
ID="CountrySqlDataSource" runat="server"
ConnectionString="<%$
ConnectionStrings:LISConnectionString %>"
SelectCommand="SELECT [CountryID],
[Country] FROM [Country] Order By Country"></asp:SqlDataSource>
</td>
</tr>
<tr>
<td style="width: 152px; text-align: left;"
valign="middle">
<asp:Label ID="lblProvince" runat="server"
Font-Bold="True" Text="Province"></asp:Label></td>
<td style="width: 84px" valign="middle">
<aspropDownList ID="DropDownProvince"
runat="server"
DataSourceID="ProvinceSqlDataSource"
DataTextField="Province"
DataValueField="ProvinceID">
</aspropDownList>
<asp:SqlDataSource ID="ProvinceSqlDataSource"
runat="server"
ConnectionString="<%$
ConnectionStrings:LISConnectionString %>">
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td style="width: 152px; text-align: left;"
valign="middle">
<strong>Purpose of Certificate:</strong>
</td>
<td style="width: 84px; text-align: left;"
valign="middle">
<asp:RadioButtonList ID="RadioButtonUsage"
runat="server"
DataSourceID="UsageSqlDataSource"
DataTextField="UsageType"
DataValueField="UsageID"
RepeatDirection="Horizontal">
</asp:RadioButtonList><asp:SqlDataSource
ID="UsageSqlDataSource" runat="server"
ConnectionString="<%$
ConnectionStrings:LISConnectionString %>"
SelectCommand="SELECT [UsageType],
[UsageID] FROM [UsageType]"></asp:SqlDataSource>
</td>
</tr>
</table>
<asp:Label ID="lblError" runat="server"
Width="426px"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"
Enabled="False" ReadOnly="True" Visible="False"></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger
ControlID="DropDownCountry" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="SetChanges" runat="server" Text="Save
Changes" /><br />
</div>
</form>
</body>
</html>
Code Behind:
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Partial Class Site_Aform_index
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not User.Identity.IsAuthenticated Then
Response.Redirect("/LIS/index.aspx")
End If
If Not IsPostBack Then
TextBox1.Text = Context.Items("Invoice").ToString()
ProvinceSqlDataSource.SelectCommand = "SELECT
[ProvinceID], [Province] FROM [Province] WHERE [CountryID] = 1 Order
By [Province]"
ProvinceSqlDataSource.Dispose()
End If
End Sub
Protected Sub DropDownCountry_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
DropDownCountry.SelectedIndexChanged
ProvinceSqlDataSource.SelectCommand = "SELECT [ProvinceID],
[Province] FROM [Province] WHERE [CountryID] = " &
DropDownCountry.SelectedValue.ToString() & "Order By Province"
If DropDownCountry.SelectedValue.ToString() = "1" Then
lblProvince.Text = "Province"
Else
lblProvince.Text = "State"
End If
ProvinceSqlDataSource.Dispose()
End Sub
Protected Sub SetChanges_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SetChanges.Click
Context.Items("Invoice") = TextBox1.Text.ToString()
Context.Items("Name") = txtName.Text.ToString()
Context.Items("Address") = txtStreetAddress.Text.ToString()
Context.Items("PhoneNum") = txtPhoneNum.Text.ToString()
Context.Items("Country") =
DropDownCountry.SelectedValue.ToString()
Context.Items("Province") =
DropDownProvince.SelectedValue.ToString()
Context.Items("Usage") =
RadioButtonUsage.SelectedValue.ToString()
Server.Transfer("/LIS/Site/AForm/AForm.aspx")
End Sub
End Class
I am able to change the country once with it giving me a different set
of Province's or States but when I try to change it again I get the
following error:
sys.webforms.pagerequestmanagerservererrorexception: An unkown error
occured while processing the request on the server. The status code
returned from the server was: 500
In my event logs I get the following:
Event code: 4009
Event message: Viewstate verification failed. Reason: The viewstate
supplied failed integrity check.
Event time: 7/4/2007 2:51:38 PM
Event time (UTC): 7/4/2007 8:51:38 PM
Event ID: 46740ac0b278431f9f4a39e791652e1d
Event sequence: 28
Event occurrence: 8
Event detail code: 50203
Application information:
Application domain: a1142f73-1-128280547596312539
Trust level: Full
Application Virtual Path: /LIS
Application Path: D:\WebProjects\LIS\
Machine name: SATURN-V
Process information:
Process ID: 6024
Process name: WebDev.WebServer.EXE
Account name: LAUNCHZONE\CurtisL
Request information:
Request URL: http://localhost:1332/LIS/Site/index.aspx
Request path: /LIS/Site/index.aspx
User host address: 127.0.0.1
User: curtis
Is authenticated: True
Authentication Type: Forms
Thread account name: LAUNCHZONE\CurtisL
ViewStateException information:
Exception message: Invalid viewstate.
Client IP: 127.0.0.1
Port:
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT
5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
PersistedState: /
wEPDwUJNTEyODE4MzQxD2QWAgIDD2QWAgIFD2QWAmYPZBYKAgkPEA8WAh4LXyFEYXRhQm91bmRnZBAVAgZDYW5hZGENVW5pdGVkIFN0YXRlcxUCATEBMhQrAwJnZxYBAgFkAgwPDxYCHgRUZXh0BQVTdGF0ZWRkAg4PEA8WAh8AZ2QQFTIHQWxhYmFtYQZBbGFza2EHQXJpem9uYQhBcmthbnNhcwpDYWxpZm9ybmlhCENvbG9yYWRvC0Nvbm5lY3RpY3V0CERlbGF3YXJlB0Zsb3JpZGEHR2VvcmdpYQZIYXdhaWkFSWRhaG8ISWxsaW5vaXMHSW5kaWFuYQRJb3dhBkthbnNhcwhLZW50dWNreQlMb3Vpc2lhbmEFTWFpbmUITWFyeWxhbmQNTWFzc2FjaHVzZXR0cwhNaWNoaWdhbglNaW5uZXNvdGELTWlzc2lzc2lwcGkITWlzc291cmkHTW9udGFuYQhOZWJyYXNrYQZOZXZhZGENTmV3IEhhbXBzaGlyZQpOZXcgSmVyc2V5Ck5ldyBNZXhpY28ITmV3IFlvcmsOTm9ydGggQ2Fyb2xpbmEMTm9ydGggRGFrb3RhBE9oaW8IT2tsYWhvbWEGT3JlZ29uDFBlbm5zeWx2YW5pYQxSaG9kZSBJc2xhbmQOU291dGggQ2Fyb2xpbmEMU291dGggRGFrb3RhCVRlbm5lc3NlZQVUZXhhcwRVdGFoB1Zlcm1vbnQIVmlyZ2luaWEKV2FzaGluZ3Rvbg1XZXN0IFZpcmdpbmlhCVdpc2NvbnNpbgdXeW9taW5nFTICMTQCMTUCMTYCMTcCMTgCMTkCMjACMjECMjICMjMCMjQCMjUCMjYCMjcCMjgCMjkCMzACMzECMzICMzMCMzQCMzUCMzYCMzcCMzgCMzkCNDACNDECNDICNDMCNDQCNDUCNDYCNDcCNDgCNDkCNTACNTECNTICNTMCNTQCNTUCNTYCNTcCNTgCNTkCNjACNjECNjICNjMUKwMyZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dkZAISDxAPFgIfAGdkEBUECVNsYXVnaHRlcgZGZWVkZXIIQnJlZWRpbmcMVW5jbGFzc2lmaWVkFQQBMQEyATMBNBQrAwRnZ2dnZGQCFw8PFgIfAQUHNzEwMDAwMGRkZJSQ
+WsrsmnnoswcJJusuGHh1gUT
Referer: http://localhost:1332/LIS/Site/index.aspx
Path: /LIS/Site/index.aspx
Custom event details:
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Can anyone help me?
I am using an UpdatePanel that has 2 dropdown menu's in it. I have
one which is the country's that is pulled from an SQL DB and another
that is a list of Province's or States that is pulled from another
table depending on which country is selected. I have an asyncronous
postback trigger that calls my SelectedIndexChanged method to run a
different query depending on what country is selected.
Code Below:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="index.aspx.vb" Inherits="Site_Aform_index" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div style="text-align: center">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />
<br />
<asp:Label ID="lblShipping" runat="server" Font-Bold="True"
Font-Size="Large" Text="Shipping Information" Width="741px"></
asp:Label><br />
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server"
UpdateMode="Conditional">
<ContentTemplate>
<table border="0" cellpadding="3" cellspacing="0"
style="width: 500px" align="center">
<tr>
<td style="width: 152px; text-align: left;"
valign="middle">
<strong>Name:</strong></td>
<td style="width: 84px" valign="middle">
<asp:TextBox ID="txtName" runat="server"
Width="261px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 152px; text-align: left;"
valign="middle">
<strong>Address: </strong>
</td>
<td style="width: 84px" valign="middle">
<asp:TextBox ID="txtStreetAddress"
runat="server" Width="261px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 152px; text-align: left;">
<strong>Phone number.:</strong></td>
<td style="width: 84px">
<asp:TextBox ID="txtPhoneNum" runat="server"
Width="215px"></asp:TextBox>
<asp:RegularExpressionValidator runat="server"
ID="regtxtPhoneNum" ControlToValidate="txtPhoneNum"
ValidationExpression="^[2-9]\d{2}-\d{3}-\d{4}$" Display=Dynamic
ErrorMessage="Please re-enter your phone number as shown"
Width="325px" Height="31px"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td style="width: 152px; text-align: left;"
valign="middle">
<strong>Country:</strong></td>
<td style="width: 84px; text-align: left;"
valign="middle">
<aspropDownList ID="DropDownCountry"
runat="server" AutoPostBack=true
DataSourceID="CountrySqlDataSource"
DataTextField="Country"
DataValueField="CountryID">
</aspropDownList><asp:SqlDataSource
ID="CountrySqlDataSource" runat="server"
ConnectionString="<%$
ConnectionStrings:LISConnectionString %>"
SelectCommand="SELECT [CountryID],
[Country] FROM [Country] Order By Country"></asp:SqlDataSource>
</td>
</tr>
<tr>
<td style="width: 152px; text-align: left;"
valign="middle">
<asp:Label ID="lblProvince" runat="server"
Font-Bold="True" Text="Province"></asp:Label></td>
<td style="width: 84px" valign="middle">
<aspropDownList ID="DropDownProvince"
runat="server"
DataSourceID="ProvinceSqlDataSource"
DataTextField="Province"
DataValueField="ProvinceID">
</aspropDownList>
<asp:SqlDataSource ID="ProvinceSqlDataSource"
runat="server"
ConnectionString="<%$
ConnectionStrings:LISConnectionString %>">
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td style="width: 152px; text-align: left;"
valign="middle">
<strong>Purpose of Certificate:</strong>
</td>
<td style="width: 84px; text-align: left;"
valign="middle">
<asp:RadioButtonList ID="RadioButtonUsage"
runat="server"
DataSourceID="UsageSqlDataSource"
DataTextField="UsageType"
DataValueField="UsageID"
RepeatDirection="Horizontal">
</asp:RadioButtonList><asp:SqlDataSource
ID="UsageSqlDataSource" runat="server"
ConnectionString="<%$
ConnectionStrings:LISConnectionString %>"
SelectCommand="SELECT [UsageType],
[UsageID] FROM [UsageType]"></asp:SqlDataSource>
</td>
</tr>
</table>
<asp:Label ID="lblError" runat="server"
Width="426px"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"
Enabled="False" ReadOnly="True" Visible="False"></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger
ControlID="DropDownCountry" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="SetChanges" runat="server" Text="Save
Changes" /><br />
</div>
</form>
</body>
</html>
Code Behind:
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Partial Class Site_Aform_index
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not User.Identity.IsAuthenticated Then
Response.Redirect("/LIS/index.aspx")
End If
If Not IsPostBack Then
TextBox1.Text = Context.Items("Invoice").ToString()
ProvinceSqlDataSource.SelectCommand = "SELECT
[ProvinceID], [Province] FROM [Province] WHERE [CountryID] = 1 Order
By [Province]"
ProvinceSqlDataSource.Dispose()
End If
End Sub
Protected Sub DropDownCountry_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
DropDownCountry.SelectedIndexChanged
ProvinceSqlDataSource.SelectCommand = "SELECT [ProvinceID],
[Province] FROM [Province] WHERE [CountryID] = " &
DropDownCountry.SelectedValue.ToString() & "Order By Province"
If DropDownCountry.SelectedValue.ToString() = "1" Then
lblProvince.Text = "Province"
Else
lblProvince.Text = "State"
End If
ProvinceSqlDataSource.Dispose()
End Sub
Protected Sub SetChanges_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SetChanges.Click
Context.Items("Invoice") = TextBox1.Text.ToString()
Context.Items("Name") = txtName.Text.ToString()
Context.Items("Address") = txtStreetAddress.Text.ToString()
Context.Items("PhoneNum") = txtPhoneNum.Text.ToString()
Context.Items("Country") =
DropDownCountry.SelectedValue.ToString()
Context.Items("Province") =
DropDownProvince.SelectedValue.ToString()
Context.Items("Usage") =
RadioButtonUsage.SelectedValue.ToString()
Server.Transfer("/LIS/Site/AForm/AForm.aspx")
End Sub
End Class
I am able to change the country once with it giving me a different set
of Province's or States but when I try to change it again I get the
following error:
sys.webforms.pagerequestmanagerservererrorexception: An unkown error
occured while processing the request on the server. The status code
returned from the server was: 500
In my event logs I get the following:
Event code: 4009
Event message: Viewstate verification failed. Reason: The viewstate
supplied failed integrity check.
Event time: 7/4/2007 2:51:38 PM
Event time (UTC): 7/4/2007 8:51:38 PM
Event ID: 46740ac0b278431f9f4a39e791652e1d
Event sequence: 28
Event occurrence: 8
Event detail code: 50203
Application information:
Application domain: a1142f73-1-128280547596312539
Trust level: Full
Application Virtual Path: /LIS
Application Path: D:\WebProjects\LIS\
Machine name: SATURN-V
Process information:
Process ID: 6024
Process name: WebDev.WebServer.EXE
Account name: LAUNCHZONE\CurtisL
Request information:
Request URL: http://localhost:1332/LIS/Site/index.aspx
Request path: /LIS/Site/index.aspx
User host address: 127.0.0.1
User: curtis
Is authenticated: True
Authentication Type: Forms
Thread account name: LAUNCHZONE\CurtisL
ViewStateException information:
Exception message: Invalid viewstate.
Client IP: 127.0.0.1
Port:
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT
5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
PersistedState: /
wEPDwUJNTEyODE4MzQxD2QWAgIDD2QWAgIFD2QWAmYPZBYKAgkPEA8WAh4LXyFEYXRhQm91bmRnZBAVAgZDYW5hZGENVW5pdGVkIFN0YXRlcxUCATEBMhQrAwJnZxYBAgFkAgwPDxYCHgRUZXh0BQVTdGF0ZWRkAg4PEA8WAh8AZ2QQFTIHQWxhYmFtYQZBbGFza2EHQXJpem9uYQhBcmthbnNhcwpDYWxpZm9ybmlhCENvbG9yYWRvC0Nvbm5lY3RpY3V0CERlbGF3YXJlB0Zsb3JpZGEHR2VvcmdpYQZIYXdhaWkFSWRhaG8ISWxsaW5vaXMHSW5kaWFuYQRJb3dhBkthbnNhcwhLZW50dWNreQlMb3Vpc2lhbmEFTWFpbmUITWFyeWxhbmQNTWFzc2FjaHVzZXR0cwhNaWNoaWdhbglNaW5uZXNvdGELTWlzc2lzc2lwcGkITWlzc291cmkHTW9udGFuYQhOZWJyYXNrYQZOZXZhZGENTmV3IEhhbXBzaGlyZQpOZXcgSmVyc2V5Ck5ldyBNZXhpY28ITmV3IFlvcmsOTm9ydGggQ2Fyb2xpbmEMTm9ydGggRGFrb3RhBE9oaW8IT2tsYWhvbWEGT3JlZ29uDFBlbm5zeWx2YW5pYQxSaG9kZSBJc2xhbmQOU291dGggQ2Fyb2xpbmEMU291dGggRGFrb3RhCVRlbm5lc3NlZQVUZXhhcwRVdGFoB1Zlcm1vbnQIVmlyZ2luaWEKV2FzaGluZ3Rvbg1XZXN0IFZpcmdpbmlhCVdpc2NvbnNpbgdXeW9taW5nFTICMTQCMTUCMTYCMTcCMTgCMTkCMjACMjECMjICMjMCMjQCMjUCMjYCMjcCMjgCMjkCMzACMzECMzICMzMCMzQCMzUCMzYCMzcCMzgCMzkCNDACNDECNDICNDMCNDQCNDUCNDYCNDcCNDgCNDkCNTACNTECNTICNTMCNTQCNTUCNTYCNTcCNTgCNTkCNjACNjECNjICNjMUKwMyZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dkZAISDxAPFgIfAGdkEBUECVNsYXVnaHRlcgZGZWVkZXIIQnJlZWRpbmcMVW5jbGFzc2lmaWVkFQQBMQEyATMBNBQrAwRnZ2dnZGQCFw8PFgIfAQUHNzEwMDAwMGRkZJSQ
+WsrsmnnoswcJJusuGHh1gUT
Referer: http://localhost:1332/LIS/Site/index.aspx
Path: /LIS/Site/index.aspx
Custom event details:
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Can anyone help me?