I feel almost stupid asking this because I think the answer is probably very basic. But, here it goes.
I am designing a website with a button that "rolls dice" then enables other buttons on the page (categories in my game), which ultimately, will use those buttons to go to the proper category. So, in effect, [click "roll ..."], the C# of the page (Game.aspx.cs) processes which buttons to enable, display/enable those buttons for click-ability.
My problem is this:
The page is
[domain]/UncommonSense/Game.aspx
but after I click the "roll ..." button the URL turns to
[domain]/Game.aspx#/Game.aspx
This causes a problem in the categories buttons because I need to redirect to
[domain]/UncommonSense/Question.aspx
but since Game.aspx#/ has taken the place of UncommonSense/ it fails.
CODE:
Okay, here is the code in my Game.aspx file. The button is the "ID=Roll" button listed right below "Label12." The code behind is literally right now a blank function so it is not doing anything on the C# side except posting back (apparently). However, when that button is clicked the URL goes from:
[domain]/UncommonSense/Game.aspx
to
[domain]/Game.aspx#/Game.aspx
NOTE: I just tested from a root directory and it did about the same thing:
[domain]/Game.aspx
became
[domain]/Game.aspx#/Game.aspx
Maybe this has something to do with the form?
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Game.aspx.cs" Inherits="Uncommon_Sense.Game" %>
<!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 runat="server">
<title>Uncommon Sense</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript">
</script>
</head>
<body>
<form id="form1" runat="server">
<div data-role="page">
<div data-role="header" data-theme="b">
<h1><asp:Label ID="Label1" runat="server" Text="Uncommon Sense"></asp:Label></h1>
</div>
<div data-role="content">
<h4><asp:Label ID="Label4" runat="server" Text="Game Statistics"></asp:Label></h4>
<asp:Label ID="Label11" runat="server" data-mini="true" Text=""></asp:Label>
<asp:Label ID="Label10" runat="server" data-mini="true" Text=""></asp:Label>
<h4><asp:Label ID="Label2" runat="server" Text="Game Play"></asp:Label></h4>
<asp:Button ID="Roll" runat="server" Text="Roll Dice ..." data-mini="true"
onclick="Roll_Click" />
<hr width="80%" />
<div class="ui-grid-c">
<div class="ui-block-a">
<asp:Button ID="btnShortStuffChecked" runat="server" Text="Short Stuff" data-mini="true"
data-icon="check" Enabled="False" Visible="False" />
<asp:Button ID="btnShortStuffNotChecked" runat="server" Text="Short Stuff" data-mini="true"
Enabled="False" Visible="False" onclick="btnShortStuffNotChecked_Click" /></div>
<div class="ui-block-b">
<asp:Button ID="btnWhoSaidChecked" runat="server" Text="Who Said?" data-mini="true"
data-icon="check" Enabled="False" Visible="False" />
<asp:Button ID="btnWhoSaidNotChecked" runat="server" Text="Who Said?" data-mini="true"
Enabled="False" Visible="False" /></div>
<div class="ui-block-c">
<asp:Button ID="btnCommonQuipChecked" runat="server" Text="Common Quip" data-mini="true"
data-icon="check" Enabled="False" Visible="False" />
<asp:Button ID="btnCommonQuipNotChecked" runat="server" Text="Common Quip" data-mini="true"
Enabled="False" Visible="False" /></div>
<div class="ui-block-d">
<asp:Button ID="btnRhymeTimeChecked" runat="server" Text="Rhyme Time" data-mini="true"
data-icon="check" Enabled="False" Visible="False" />
<asp:Button ID="btnRhymeTimeNotChecked" runat="server" Text="Rhyme Time" data-mini="true"
Enabled="False" Visible="False" /></div>
<div class="ui-block-a">
<asp:Button ID="btnAnythingGoesChecked" runat="server" Text="Anything Goes" data-mini="true"
data-icon="check" Enabled="False" Visible="False" />
<asp:Button ID="btnAnythingGoesNotChecked" runat="server" Text="Anything Goes" data-mini="true"
Enabled="False" Visible="False" /></div>
<div class="ui-block-b">
<asp:Button ID="btnDefineItChecked" runat="server" Text="Define It" data-mini="true"
data-icon="check" Enabled="False" Visible="False" />
<asp:Button ID="btnDefineItNotChecked" runat="server" Text="Define It" data-mini="true"
Enabled="False" Visible="False" /></div>
<div class="ui-block-c">
<asp:Button ID="btnAllAbroadChecked" runat="server" Text="All Abroad" data-mini="true"
data-icon="check" Enabled="False" Visible="False" />
<asp:Button ID="btnAllAbroadNotChecked" runat="server" Text="All Abroad" data-mini="true"
Enabled="False" Visible="False" /></div>
<div class="ui-block-d">
<asp:Button ID="btnSpellItChecked" runat="server" Text="Spell It" data-mini="true"
data-icon="check" Enabled="False" Visible="False" />
<asp:Button ID="btnSpellItNotChecked" runat="server" Text="Spell It" data-mini="true"
Enabled="False" Visible="False" /></div>
</div>
<h4><asp:Label ID="Label3" runat="server" Text="Settings"></asp:Label>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Question.aspx">HyperLink</asp:HyperLink>
</h4>
<label for="slider-0">Computer Difficulty:</label>
<input type="range" name="slider" id="slider-0" value="2" min="1" max="4" />
<h3><asp:Label ID="Label5" runat="server" Text="Label"></asp:Label></h3>
<asp:Button ID="ChoiceA" runat="server" Text="Button" onclick="ChoiceA_Click" />
<asp:Button ID="Button2" runat="server" Text="Button" Visible="False" />
<asp:Button ID="Button3" runat="server" Text="Button" Visible="False" />
</div>
</div>
</form>
</body>
</html>
UPDATE:
And the answer is ... JQuery Mobile!
By simply removing the reference to JQuery Mobile the problem is solved so apparently this is something in their library that changes URLs. That sucks because I liked using JQuery Mobile. Oh well, my comments will stop now on the annoyance because I am appreciative of the 99.9% of the stuff they do that helps. But, for the record...
ANY LINK will have:
linker.aspx
changed to:
linker#/linker.aspx
for some reason.
Related
What I want to happen is to create a statement that describes the type of work the user selects in the second dropdown list (titled workList). When the user selects one of the options from the dropdown list, I want a short text description of that work to appear where the label below it is (titled lblWork). I only have one option in the event (workListChanged) right now. Once I figure out how to make THAT display, I should be able to finish the rest. But I can't figure out how to get the label to display something based on the selection. The error I'm currently receiving is "cannot implicity convert type 'string' to 'bool' in the "if" statement in the workListChanged event.
<%# Page Language="C#" Debug="true" %>
<!DOCTYPE html>
<script runat="server">
protected void workListChanged(object sender, EventArgs e)
{
if (workList.SelectedItem.Text = "Office Work")
lblWork.Text = "You prefer to stay inside and code your life away.";
}
</script>
<html>
<head id="Head1" runat="server">
<title>Personality Test</title>
<style>
ul {
list-style-type: none;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label id="lblName"
Text="Name"
AssociatedControlID="txtName"
runat="server" />
<asp:TextBox
id="txtname"
AutoPostBack="true"
runat="server" />
<br /><br />
<asp:TextBox
id="textComments"
Text="Tell me a little about yourself"
TextMode="MultiLine"
Columns="30"
rows="10"
runat="server" />
<br /><br />
Select a gender:
<asp:RadioButton
id="rd1Male"
Text="Male"
GroupName="rgGender"
runat="server" />
<asp:RadioButton
id="rd1Female"
Text="Female"
GroupName="rgGender"
runat="server" />
<br /><br />
<strong>Favorite Season:</strong>
<br />
<asp:DropDownList
id="DropDownList1"
Runat="server"
AutoPostBack="true"
>
<asp:ListItem Text="Spring" />
<asp:ListItem Text="Summer" />
<asp:ListItem Text="Autumn" />
<asp:ListItem Text="Winter" />
</asp:DropDownList>
<br /><br />
<strong>Which of the following colors are your favorite?</strong>
<ul>
<li>
<asp:RadioButton
id="rd1Red"
Text="Red"
GroupName="colors"
runat="server" />
</li>
<li>
<asp:RadioButton
id="rd1Blue"
Text="Blue"
GroupName="colors"
runat="server" />
</li>
<li>
<asp:RadioButton
id="rd1Purple"
Text="Purple"
GroupName="colors"
runat="server" />
</li>
<li>
<asp:RadioButton
id="rd1Yellow"
Text="Yellow"
GroupName="colors"
runat="server" />
</li>
<li>
<asp:RadioButton
id="rd1Green"
Text="Green"
GroupName="colors"
runat="server" />
</li>
<li>
<asp:RadioButton
id="rd1Orange"
Text="Orange"
GroupName="colors"
runat="server" />
</li>
<li>
<asp:RadioButton
id="rd1Violet"
Text="Violet"
GroupName="colors"
runat="server" />
</li>
<li>
<asp:RadioButton
id="rd1Pink"
Text="Pink"
GroupName="colors"
runat="server" />
</li>
<li>
<asp:RadioButton
id="rd1Brown"
Text="Brown"
GroupName="colors"
runat="server" />
</li>
<li>
<asp:RadioButton
id="d1Grey"
Text="Grey"
GroupName="colors"
runat="server" />
</li>
</ul>
<br /><br />
<strong>Which type of work do you prefer?</strong>
<br />
<asp:DropDownList
id="workList"
Runat="server"
AutoPostBack="true"
OnSelectedIndexChanged="workListChanged">
<asp:ListItem Text="Office Work" />
<asp:ListItem Text="Outdoor Work" />
<asp:ListItem Text="Investigative Work" />
<asp:ListItem Text="Working With People" />
<asp:ListItem Text="Work Requiring Travel" />
<asp:ListItem Text="Helping People" />
</asp:DropDownList>
<br />
<asp:Label
id="lblWork"
runat ="server" />
</div>
</form>
</body>
</html>
Try changing your if statement as below. You are using a = which means you are trying to assign value, rather use == for string comparison. You cannot do if (stringExpression), since an if statement only works on a boolean.
protected void workListChanged(object sender, EventArgs e)
{
if (workList.SelectedItem.Text == "Office Work")
lblWork.Text = "You prefer to stay inside and code your life away.";
}
Edit:
Current layout:
Im trying to work out how within my ASP webpage design I can posistion a div (server side) under another div.
To my question further I'll use the following screenshots:
Currently this is my layout:
I want to position 2 more div one under another to give me a 'title' div and a 'description' div tat will later be populated by my database results, as shown:
This is my current source code. Can someone push me in the right direction of how i go about implementing these divs one of top of another like this?
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Show.aspx.cs" Inherits="ViewCDs.Show" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div style=" float:left;">
<asp:Image ID="Image1" runat="server" Height="145px" ViewStateMode="Enabled"
Width="185px" />
</div>
<div style=" float:left; width: 395px; height: 140px;">
<asp:FormView ID="FormView1" runat="server">
<EditItemTemplate>
coffeeName:
<asp:TextBox ID="coffeeNameTextBox" runat="server"
Text='<%# Bind("coffeeName") %>' />
<br />
coffeeOrigin:
<asp:TextBox ID="coffeeOriginTextBox" runat="server"
Text='<%# Bind("coffeeOrigin") %>' />
<br />
coffeeStrength:
<asp:TextBox ID="coffeeStrengthTextBox" runat="server"
Text='<%# Bind("coffeeStrength") %>' />
<br />
coffeeGrind:
<asp:TextBox ID="coffeeGrindTextBox" runat="server"
Text='<%# Bind("coffeeGrind") %>' />
<br />
coffeePrice:
<asp:TextBox ID="coffeePriceTextBox" runat="server"
Text='<%# Bind("coffeePrice") %>' />
<br />
coffeeQty:
<asp:TextBox ID="coffeeQtyTextBox" runat="server"
Text='<%# Bind("coffeeQty") %>' />
<br />
coffeeRRP:
<asp:TextBox ID="coffeeRRPTextBox" runat="server"
Text='<%# Bind("coffeeRRP") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
coffeeName:
<asp:TextBox ID="coffeeNameTextBox" runat="server"
Text='<%# Bind("coffeeName") %>' />
<br />
coffeeOrigin:
<asp:TextBox ID="coffeeOriginTextBox" runat="server"
Text='<%# Bind("coffeeOrigin") %>' />
<br />
coffeeStrength:
<asp:TextBox ID="coffeeStrengthTextBox" runat="server"
Text='<%# Bind("coffeeStrength") %>' />
<br />
coffeeGrind:
<asp:TextBox ID="coffeeGrindTextBox" runat="server"
Text='<%# Bind("coffeeGrind") %>' />
<br />
coffeePrice:
<asp:TextBox ID="coffeePriceTextBox" runat="server"
Text='<%# Bind("coffeePrice") %>' />
<br />
coffeeQty:
<asp:TextBox ID="coffeeQtyTextBox" runat="server"
Text='<%# Bind("coffeeQty") %>' />
<br />
coffeeRRP:
<asp:TextBox ID="coffeeRRPTextBox" runat="server"
Text='<%# Bind("coffeeRRP") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
<b>Origin:</b>
<asp:Label ID="coffeeOriginLabel" runat="server"
Text='<%# Bind("coffeeOrigin") %>' />
<br />
<br />
<b>Grind:</b>
<asp:Label ID="coffeeGrindLabel" runat="server"
Text='<%# Bind("coffeeGrind") %>' />
<br />
<br />
<b>Price: £</b>
<asp:Label ID="coffeePriceLabel" runat="server"
Text='<%# Bind("coffeePrice") %>' />
<br />
<br />
<b>Strength:</b>
<asp:Label ID="coffeeStrengthLabel" runat="server"
Text='<%# Bind("coffeeStrength") %>' />
<br />
<br />
<b>Stock Level:</b>
<asp:Label ID="coffeeQtyLabel" runat="server" Text='<%# Bind("coffeeQty") %>' />
<br />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:CoffeeConnectionString %>"
SelectCommand="SELECT [coffeeName], [coffeeOrigin], [coffeeStrength], [coffeeGrind], [coffeePrice], [coffeeQty], [coffeeRRP] FROM [Coffees]">
</asp:SqlDataSource>
<br />
</div>
<div style=" float:left; width: 339px; height: 140px;">
<br />
<div style=" float:left; width: 165px; height: 25px;">
<b><asp:Label ID="Label1" runat="server" Text="Select Coffee Grind:"></asp:Label> </b>
</div>
<div style=" float:right; width: 165px; height: 25px;">
<asp:DropDownList ID="DropDownList1" runat="server" Height="21px" Width="161px">
<asp:ListItem>Beans</asp:ListItem>
<asp:ListItem>Smooth</asp:ListItem>
<asp:ListItem>Course</asp:ListItem>
</asp:DropDownList>
</div>
<div style=" float:left; width: 165px; height: 40px;">
<br />
<b><asp:Label ID="Label2" runat="server" Text="Quantity:"></asp:Label></b>
</div>
<div style=" float:right; width: 165px; height: 40px;">
<br />
<asp:TextBox ID="TextBox1" runat="server" Width="40px">1</asp:TextBox>
</div>
<div style=" float:left; width: 165px; height: 40px;">
<br />
<asp:Button ID="Button1" runat="server" Text="Buy" />
</div>
</div>
You would simply need to add two more divs beneath that code.
<div id="title"> </div> <br/>
<div id="description"> </div> <br/>
However if you would like to control their attributes such as visibility then you would just need to make those asp.net panels.
<asp:Panel runat="server" ID="title"> </asp:Panel> <br/>
<asp:Panel runat="server" ID="description"> </asp:Panel> <br/>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ContentTemplate>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Button" PostBackUrl="~/testing2.aspx" />
<asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server"
targetControlID="Button1"
ConfirmText="Are you sure you want to click this button"
ConfirmOnFormSubmit="True" />
<asp:TextBox ID="TextBox1" runat="server" Height="25px"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
My ConfirmButtonExtender just not working. The website do not pop up a box for me. Do I miss somethings? My code is above.
I think you are missing OnClientCancel property. Check out the working example below.
Ensure your page is using proper master page. This is a working code.
asp:Content ContentPlaceHolderID="SampleContent" Runat="Server">
<script type='text/javascript'>
function cancelClick() {
var label = $get('ctl00_SampleContent_Label1');
label.innerHTML = 'You hit cancel in the Confirm dialog on ' + (new Date()).localeFormat("T") + '.';
}
</script>
<ajaxToolkit:ToolkitScriptManager runat="Server" EnablePartialRendering="true" ID="ScriptManager1" />
<div class="demoarea">
<div class="demoheading">ConfirmButton Demonstration</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:LinkButton ID="LinkButton" runat="server" OnClick="Button_Click">Click Me</asp:LinkButton>
<ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server"
TargetControlID="LinkButton"
ConfirmText="Are you sure you want to click the LinkButton?"
OnClientCancel="cancelClick" />
<br />
<br />
<asp:Button ID="Button" runat="server" Text="Click Me" OnClick="Button_Click" /><br />
<ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender2" runat="server"
TargetControlID="Button"
OnClientCancel="cancelClick"
DisplayModalPopupID="ModalPopupExtender1" />
<br />
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button" PopupControlID="PNL" OkControlID="ButtonOk" CancelControlID="ButtonCancel" BackgroundCssClass="modalBackground" />
<asp:Panel ID="PNL" runat="server" style="display:none; width:200px; background-color:White; border-width:2px; border-color:Black; border-style:solid; padding:20px;">
Are you sure you want to click the Button?
<br /><br />
<div style="text-align:right;">
<asp:Button ID="ButtonOk" runat="server" Text="OK" />
<asp:Button ID="ButtonCancel" runat="server" Text="Cancel" />
</div>
</asp:Panel>
<asp:Label ID="Label1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
I have four textboxes one combobox and one button ( and some other controls) in my page . Based on the values typed in the textboxes the related values are updated in the combobox. On clicking the submit button in my page It was giving the following error .
"Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For Secuity purposes,this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected . Use the ClientScriptManager.RegisterForEventsValidation method in order to register the postback or callback data for validation."
Now in the page directive I added
<%#Page EnableEentValidation="false">
When I type the values in the four textboxes the corresponding value will appear in the cobobox . But when I select that combobox value, the selected value wil be deleted . What is the reason for this ?
<%# Page Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="AddeChecklist.aspx.cs"
Inherits="LabTrack.WebApplication.Echecklist.AddeChecklist" EnableEventValidation ="false" %>
<%# Register TagPrefix="Labinal" TagName="AutoCompleteControl" Src="~/UserControls/AutoCompleteEnabledWebUserControl.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="../Styles/CheckListRev.css" rel="stylesheet" type="text/css" />
<!-- Style for the page -->
<link href="../Styles/AddeChecklist.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server">
</asp:ScriptManager>
<asp:Panel ID="ErrorMessagePanel" CssClass="ErrorPanel" Visible="true" runat="server">
<div class="ErrorDiv">
<asp:BulletedList CssClass="ErrorMessage" ID="ErrorMessageBulletedList" runat="server">
</asp:BulletedList>
</div>
</asp:Panel>
<div class="PageTitle">
<asp:Label ID="PageHeaderLabel" runat="server"></asp:Label>
</div>
<div class="MainDiv">
<div style="text-align: center;">
<div class="PlaceHolder">
<table id="formTable">
<tr>
<td>
<asp:UpdatePanel runat="server" ID="updatepanelCustomer" UpdateMode="Conditional">
<ContentTemplate>
<span class="boldLabelLong">Customer:</span><br />
<asp:TextBox ID="CustomerNameTextBox" Width="200" runat="server"></asp:TextBox>
<asp:HiddenField ID="IxCustomerHiddenField" runat="server" />
<asp:Button ID="customerTriggerbutton" runat="server" Text="Button" Style="display: none;" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
<td>
<asp:UpdatePanel runat="server" ID="updatepanelProgram" UpdateMode="Conditional">
<ContentTemplate>
<span class="boldLabelLong">Program:</span><br />
<asp:TextBox ID="ProgramNameTextBox" Width="200" runat="server"></asp:TextBox>
<asp:Button ID="programTriggerbutton" runat="server" Text="Button" Style="display: none;" />
<asp:HiddenField ID="IxProgramHiddenField" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="customerTriggerbutton" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</td>
<td>
<asp:UpdatePanel runat="server" ID="updatepanelWorkPackage" UpdateMode="Conditional">
<ContentTemplate>
<span class="boldLabelLong">WorkPackage:</span><br />
<asp:TextBox ID="WorkPackageNameTextBox" Width="200" runat="server"></asp:TextBox>
<asp:HiddenField ID="IxWorkPackageHiddenField" runat="server" />
<asp:Button ID="workPackageTriggerbutton" runat="server" Text="Button" Style="display: none;" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="programTriggerbutton" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</td>
<td>
<asp:UpdatePanel runat="server" ID="updatepanelActivity" UpdateMode="Conditional">
<ContentTemplate>
<span class="boldLabelLong">Activity:</span><br />
<asp:TextBox ID="ActivityNameTextBox" Width="200" runat="server"></asp:TextBox>
<asp:HiddenField ID="IxActivityHiddenField" runat="server" />
<asp:Button ID="activityTriggerbutton" runat="server" Text="Button" Style="display: none;" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="workPackageTriggerbutton" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="activityTriggerbutton" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
</table>
</div>
<div class="PlaceHolder">
<asp:Label ID="TemplateLabel" Text="Template:" CssClass="ControlLabel" runat="server"></asp:Label>
<asp:UpdatePanel runat="server" ID="updatepanelTemplate" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="TemplateSelectDropDownList" runat="server" Width="400" Visible="true"
AutoPostBack="true">
</asp:DropDownList>
<asp:HiddenField ID="IxTemplateHiddenField" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="workPackageTriggerbutton" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:Panel ID="SustainPanelTemplateOwner" Visible="true" runat="server">
<div>
<asp:Label ID="TemplateOwnerLabel" Text="Owner:" CssClass="ControlLabel" runat="server"></asp:Label>
<asp:TextBox ID="TemplateOwnerTextBox" CssClass="controlMargin" Width="400" runat="server"></asp:TextBox>
</div>
</asp:Panel>
<asp:HiddenField ID="IxDeliverableHiddenField" runat="server" />
<asp:HiddenField ID="IxReleaseActionHiddenField" runat="server" />
<asp:HiddenField ID="IxConfigHiddenField" runat="server" />
<asp:HiddenField ID="IxTemplateOwnerHiddenField" runat="server" />
<asp:HiddenField ID="TemplateSelectedSnameHiddenField" runat="server" />
<asp:HiddenField ID="TemplateOwnerSelectedsNameHiddenField" runat="server" />
<asp:HiddenField ID="DeliverableSelectedHiddenField" runat="server" />
<div>
<asp:Label ID="DeliverableLabel" CssClass="ControlLabel" runat="server" Text="Deliverable:"></asp:Label>
<asp:TextBox ID="DeliverableTextBox" CssClass="controlMargin" Width="400" runat="server"></asp:TextBox>
</div>
<asp:Panel ID="SustainPanelConfig" Visible="true" runat="server">
<div>
<asp:Label ID="ConfigurationLabel" runat="server" Text="Configuration:" CssClass="ControlLabel"></asp:Label>
<select id="ConfigurationSelect" class="controlMargin">
<option></option>
</select>
</div>
</asp:Panel>
<asp:Panel ID="SustainPanelRelease" Visible="true" runat="server">
<div>
<asp:Label ID="ReleaseActionLabel" CssClass="ControlLabel" runat="server" Text="Release Action:"></asp:Label>
<asp:TextBox ID="ReleaseActionTextBox" CssClass="controlMargin" Width="400" runat="server"></asp:TextBox>
</div>
</asp:Panel>
<asp:Panel ID="SustainPanel" Visible="true" runat="server">
<div class="SustainPanelControls">
<div>
<asp:Label ID="ChangeLabel" Text="Change #: " runat="server"></asp:Label>
</div>
<div>
<asp:TextBox ID="ChangeTextBox" Width="110" runat="server"></asp:TextBox>
</div>
<div>
<asp:Label ID="SupplementLabel" Text="Supplement: " runat="server"></asp:Label>
</div>
<div>
<asp:TextBox ID="SupplementTextBox" Width="80" runat="server"></asp:TextBox>
</div>
<div>
<asp:Label ID="NewWrrLabel" Text="WRR #: " runat="server"></asp:Label>
</div>
<div>
<asp:TextBox ID="NewWrrTextBox" Width="80" runat="server"></asp:TextBox>
</div>
<div>
<asp:Label ID="DddLabel" Text="3D: " runat="server"></asp:Label>
</div>
<div>
<asp:TextBox ID="DddTextBox" Width="80" runat="server"></asp:TextBox>
</div>
</div>
<div>
<table id="DesignDataTable2">
<tr>
<td>
<asp:Label ID="AllFbSheetsWrrLabel" Text="All F/B Sheets w/WRR #:" CssClass="ControlLabel" runat="server"></asp:Label>
</td>
<td>
<asp:TextBox CssClass="completeControl" ID="AllFbSheetsWrrTextBox" Width="588" Rows="2"
TextMode="MultiLine" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</div>
</asp:Panel>
</div>
<div class="EditButtonGroup">
<input id="EditButton" type="button" value="Edit" class="ButtonSettings" />
<input id="RemoveButton" type="button" value="-" class="ButtonSettings" />
<input id="AddButton" type="button" value="+" class="ButtonSettings" />
</div>
</div>
<div class="ViewData">
<div class="ViewDataDiv">
<table id="DesignDataTable" class="designDataTable">
<tbody>
</tbody>
</table>
</div>
</div>
<div class="submitButtonDiv">
<asp:Button ID="SubmitButton" runat="server" Text="Button Text" class="submitButtonCreateChecklist" />
</div>
</div>
</asp:Content>
You are creating new values on the client side, and posting them back to the server.
For security reasons ASP.NET implements "event validation". When even validation is enabled, if the server creates a combo with 3 possible values, it will only accept this values on postback. If you create a different value and send it back to the server, you get the error you're referring to.
Here you have some info:
Page.EnableEventValidation Property
You can use ClientScriptManager.RegisterForEventValidation Method if you know which are the possible values generated on the client side, or disable validation completely if you don't know them in advance.
To disable validation:
You set the EnableEventValidation property by setting the enableEventValidation attribute of the # Page directive or the enableEventValidation attribute of the pages element in the Web.config file. If you set this property in code, you must set it before the page is initialized.
Sounds like an issue with Viewstate overriding the values.
Try fetching the value directly using Request.Form[Dropdown.ClientId]
I have a form which I load within a modal window in that from I have used a updatepanel and a textbox named txtAccountInfo. I have set textchange event on that textbox first time change text event fired but in the second time textchange shows this message.
uncaught exception: [Exception... "'Sys.InvalidOperationException: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'uppMain'. If it is being updated dynamically then it must be inside another UpdatePanel.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "JS frame :: chrome://firebug/content/spy.js :: callPageHandler :: line 744" data: no]
my ASP.Net Code
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="mAddOrder.aspx.cs" Inherits="iSBBranch.ModalWindow.mAddOrder" %>
<!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 runat="server">
<title></title>
<style type="text/css">
</style>
</head>
<body>
<div style="width: 850px;">
<form id="form1" class="form" action="ModalWindow/mAddOrder.aspx" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="uppMain" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:HiddenField ID="txtOrderType" Value="p" runat="server" />
<asp:HiddenField ID="txtOrderStatus" Value="n" runat="server" />
<asp:HiddenField ID="txtOrderRef" runat="server" />
<fieldset id="AccountId" style="width: 783px; position:relative;">
<legend>Account Information</legend>
<p>
<label>
*Account Number </label>
<span class="relative">
<asp:TextBox ID="txtInvestorRef" CssClass="TextBox" runat="server"
OnTextChanged="txtInvestorRef_TextChanged" AutoPostBack="True"></asp:TextBox>
<span class="<%=iSBBranch.ModalWindow.mAddOrder.AccountStatus%>"></span></span>
<div style="position:absolute; right:100px; top:10px;">
<asp:UpdateProgress ID="pbContactAddress" runat="server" AssociatedUpdatePanelID="uppMain"
DisplayAfter="100" DynamicLayout="true">
<ProgressTemplate>
Loading
<img alt="Loading..." src="images/info-loader.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
</div>
</fieldset>
<div class="columns">
<!-- Left column -->
<div class="colx2-left">
<fieldset>
<legend>Post Order</legend>
<p class="inline-medium-label" style="text-align: right;">
<label for="field1">
Company</label>
<asp:DropDownList CssClass="Combobox" ID="ddlCompany" runat="server" OnSelectedIndexChanged="ddlCompany_SelectedIndexChanged"
AutoPostBack="True">
</asp:DropDownList>
</p>
<br class="clear" />
<p class="inline-medium-label" style="text-align: right;">
<label for="field1">
Total Quantiy</label>
<asp:TextBox ID="txtTotalQuantity" runat="server" CssClass="NumberField" ReadOnly="true">0</asp:TextBox>
</p>
<br class="clear" />
<p class="inline-medium-label" style="text-align: right;">
<label for="field1">
Matured Balance</label>
<asp:TextBox ID="txtMaturedBalance" runat="server" CssClass="NumberField" ReadOnly="true">0</asp:TextBox>
</p>
<br class="clear" />
<p class="inline-medium-label" style="text-align: right;">
<label for="field1">
Share Quantity</label>
<asp:TextBox ID="txtShareQuantity" CssClass="NumberField" runat="server" Text="0"
OnTextChanged="txtShareQuantity_TextChanged" AutoPostBack="True"></asp:TextBox>
</p>
<br class="clear" />
<p class="inline-medium-label" style="text-align: right;">
<label for="field1">
Rate</label>
<asp:TextBox ID="txtRate" CssClass="NumberField" runat="server" OnTextChanged="txtRate_TextChanged"
AutoPostBack="True">0</asp:TextBox>
</p>
<br class="clear" />
</fieldset>
</div>
<!-- Right column -->
<div class="colx2-left" style="margin-left: 10px;">
<fieldset>
<legend>Company’s Current</legend>
<p class="inline-medium-label" style="text-align: right;">
<label for="field1">
Market Type</label>
<asp:TextBox ID="TextBox1" ReadOnly="true" CssClass="TextBox" runat="server"></asp:TextBox>
</p>
<p class="inline-medium-label" style="text-align: right;">
<label for="field1">
Last Trade Price</label>
<asp:TextBox ID="TextBox2" runat="server" CssClass="NumberField" ReadOnly="true"></asp:TextBox>
</p>
<p class="inline-medium-label" style="text-align: right;">
<label for="field1">
Market Lot</label>
<asp:TextBox ID="TextBox3" runat="server" CssClass="NumberField" ReadOnly="true"></asp:TextBox>
</p>
<p class="inline-medium-label" style="text-align: right;">
<label for="field1">
Highest Price
</label>
<asp:TextBox ID="TextBox4" runat="server" CssClass="NumberField" Enabled="false"></asp:TextBox>
</p>
<p class="inline-medium-label" style="text-align: right;">
<label for="field1">
Lowest Price</label>
<asp:TextBox ID="TextBox5" Enabled="false" CssClass="NumberField" runat="server"></asp:TextBox>
</p>
</fieldset>
</div>
</div>
<br class="clear" />
<div class="">
<fieldset style="width: 783px;">
<div style="float: right;">
<p class="inline-medium-label" style="text-align: right;">
<label>
Total Trade Amount</label>
<asp:TextBox ID="txtTotalTradeAmount" runat="server" CssClass="NumberField" ReadOnly="true"></asp:TextBox>
</p>
</div>
</fieldset>
</div>
<br class="clear" />
<div style="margin-top: 10px;">
<asp:Button ID="btnSave" CssClass="big-button" runat="server" Text="Save"
onclick="btnSave_Click" />
<asp:Button ID="Button2" OnClientClick="return $.modal.current.closeModal();" CssClass="big-button"
runat="server" Text="Close" />
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
<%-- <asp:AsyncPostBackTrigger ControlID="txtInvestorRef" EventName="TextChanged" />--%>
</Triggers>
</asp:UpdatePanel>
</form>
</div>
<script type="text/javascript">
CenterWindow();
</script>
</body>
</html>
If I close this from and again open the from then no error shows in any times on that session.
Please advise.
Without seeing any code, this is just a guess, but this error usually means that you are trying to force one UpdatePanel to refresh from within another UpdatePanel. Are you trying to set a trigger for one, that is located within another? This is not possible.
You are also using a modal window. What are you using to render this? Is it placing the modal div within the ASP.NET form? jQuery and simpleModal do not, by default, they append it to the end of the DOM. So trying to update an UpdatePanel from inside such a dialog would also give you this error.
Please post some code and people will be able to help you better.
Try using FireBug to see if the modal window messes somehow with your updatepanel code. I might have changed the ID.