Adding rows to a GridView with jQuery and saving - c#

If I add rows to a GridView with jQuery, will I be able to get the newly added rows with:
foreach (GridViewRow row in gvMyGridView.Rows)
{
}
How could I add the rows so they could be iterated in code behind?

I put my Gridview control in an update panel and set an async trigger to point to my add button(so that the whole page is not refreshed when a new row is added).
Then in code behind, i add new row to a datatable. Save the datatable in a viewstate and rebind the gridview to the viewstate. Then when fetching data from the gridview, loop through viewstate datatable rows.
Not sure if this is the best solution, however its been working for me so far.
protected void cmdAdd(){
datatable table=(datatable)viewstate["savedTable"];
datarow row = table.newRow;
row["myColumnName"]=txtSomething.text;
datatable.rows.add(row);
viewstate["savedTable"]=table;
grid.datasource=viewstate["savedTable"];
grid.databind();
// or create your own functions to make the code reusable
}
protected void cmdSave(){
datatable table=viewstate["savedTable"];
foreach(datarow row in table.rows){
//do stuff
}
}
I usually use bootstrap modals to add new rows to my grid, and call those modal from code behind via a grid header button.
So my Gridview html looks like this:
<asp:UpdatePanel runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView runat="server" ID="stockTakeGrid"
CssClass="table table-striped table-bordered table-condensed table-hover"
AllowPaging="true" PageSize="8" OnPageIndexChanging="stockTakeGrid_PageIndexChanging"
ShowHeaderWhenEmpty="true"
OnRowCommand="stockTakeGrid_RowCommand"
OnRowDataBound="stockTakeGrid_RowDataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton runat="server" ID="cmdEdit" CssClass="btn" ToolTip="Edit Stock"
CommandName="editStock" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>">
<span><i class=" glyphicon glyphicon-pencil"></i></span>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ITEMCODE" HeaderText="Item Code" />
<asp:BoundField DataField="ITEMDESC" HeaderText="Item Desc" />
<asp:BoundField DataField="ONHAND" HeaderText="Stock On Hand" />
<asp:BoundField DataField="STCOUNT" HeaderText="Stock Count" />
<asp:BoundField DataField="VARIANCE" HeaderText="Variane" />
<asp:BoundField DataField="PRICE" HeaderText="Price" />
<asp:BoundField DataField="VALUE" HeaderText="Value" DataFormatString="{0:0,0.00}" />
<asp:BoundField DataField="COMMENT" HeaderText="Comment" />
</Columns>
<PagerStyle CssClass="pagination-ys" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cmbLocation" EventName="selectedindexchanged" />
<asp:AsyncPostBackTrigger ControlID="cmdSaveLine" EventName="click" />
</Triggers>
</asp:UpdatePanel>
Then my modal html looks like this:
<!--Item Modal-->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Set actual stock count</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<div class="form-group">
<asp:Label runat="server" CssClass="control-label col-md-2 ">Item Code</asp:Label>
<div class="col-md-2">
<asp:TextBox runat="server" ID="txtItemCode" CssClass="form-control" ReadOnly="true"></asp:TextBox>
</div>
<div class="col-md-6">
<asp:TextBox runat="server" ID="txtItemDesc" CssClass="form-control" ReadOnly="true"></asp:TextBox>
</div>
</div>
<div class="form-group">
<asp:Label runat="server" CssClass="control-label col-md-2">Stock on Hand</asp:Label>
<div class="col-md-2">
<asp:TextBox runat="server" ID="txtOnHand" CssClass="form-control" ReadOnly="true"></asp:TextBox>
</div>
</div>
<div class="form-group">
<asp:Label runat="server" CssClass="control-label col-md-2">Stock Count</asp:Label>
<div class="col-md-2">
<asp:TextBox runat="server" ID="txtSTCount" CssClass="form-control decimal-empty"></asp:TextBox>
</div>
</div>
<div class="form-group">
<asp:Label runat="server" CssClass="control-label col-md-2">Comment</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" CssClass="form-control" TextMode="MultiLine" ID="txtComment" ></asp:TextBox>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="stockTakeGrid" EventName="rowcommand" />
</Triggers>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<asp:Button runat="server" ID="cmdSaveLine" CssClass="btn btn-info pull-left" Text="Save"
OnClientClick="$('#myModal').modal('hide');" OnClick="cmdSaveLine_Click" />
</ContentTemplate>
</asp:UpdatePanel>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Hope this helps!

Related

How to use edit button in Datagrid to show modal

Hi I am currently trying to find a way to show a modal whenever i click on the edit button on my table. Here is my front code:
<div class="col-sm-3"></div>
<div class=" row col-sm-6 panel-body">
<asp:DataGrid CssClass=" table table-borderless" OnItemCommand="PO_Form_ItemCommand" ID="PO_Form" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:ButtonColumn ButtonType="LinkButton" Text="Edit" CommandName="grdEdit"></asp:ButtonColumn>
<asp:ButtonColumn ButtonType="LinkButton" Text="Delete" CommandName="grdDel"></asp:ButtonColumn>
<asp:BoundColumn DataField="PO_no" HeaderText="PO No." />
<asp:BoundColumn DataField="supplier_name" HeaderText="Supplier name" />
<asp:BoundColumn DataField="flight_no" HeaderText="Flight No." />
<asp:BoundColumn DataField="bkg_date" HeaderText="Booking Date" />
<asp:BoundColumn DataField="status" HeaderText="Status" />
</Columns>
<HeaderStyle BackColor="#666666" />
</asp:DataGrid>
</div>
<%-- Modal top --%>
<div id="editmodal" class="modal" runat="server" role="dialog">
<div class="modal-dialog">
<%-- Modal Content --%>
<div class="modal-content">
<div class="modal-content">
<button type="button" class="btn btn-default" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"></button>
</div>
</div>
</div>
</div>
<%-- Modal Bottom --%>
It would really be helpful if there is someone who understands my situation. Thank you.

Update Progress not working for Upload Button inside Update Panel

I have a functionality where I am uploading an excel file and downloading its format to again Upload the data.
So for that I am using Update Progress for loading in between
My Update progress is working fine for Download Format button, but it is not working for Button Upload
Below is my aspx code:-
<asp:UpdatePanel ID="uptc" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:TabContainer ID="TbTabValue" runat="server" ActiveTabIndex="0" AutoPostBack="true" OnActiveTabChanged="tc_ActiveTabChanged">
<asp:TabPanel ID="tpEnterprise"
HeaderText="Enterprise"
runat="server"
ActiveTabIndex="1"
OnDemand="true"
AutoPostBack="false"
TabStripPlacement="Top"
CssClass="ajax__tab_xp"
ScrollBars="None"
UseVerticalStripPlacement="true"
VerticalStripWidth="120px"
TabIndex="1">
<ContentTemplate>
<asp:UpdateProgress ID="UpdateProgress" runat="server" DynamicLayout="False" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="0">
<ProgressTemplate>
<div class="loadingModal">
<div class="center">
<img alt="" src="../Images/loading.gif" />
</div>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-sm-4">
<label>Select Category</label>
<asp:DropDownList ID="ddlEnterpriseCategory" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlEnterpriseCategory_SelectedIndexChanged"></asp:DropDownList>
<asp:Button runat="server" ID="btnDownloadEnterpriceExcel" Text="Download Format" Class="btn btn-default" OnClick="downloadEnterpriceExcel_Click" />
</div>
<div class="col-sm-8">
<label>Upload File</label>
<asp:FileUpload ID="EnterpriseFileuploader" runat="server" />
<br />
<asp:Button ID="btnUpload" runat="server" Text="Upload"
OnClick="btnUpload_Click" Class="btn btn-default" />
</div>
</div>
<br />
<div class="row">
<div class="col-sm-12">
<asp:Panel runat="server" ID="gvInputDataPanel">
<asp:GridView ID="gvInputData" runat="server" CssClass="table table-bordered" AllowPaging="True" OnPageIndexChanging="gvInputData_PageIndexChanging" EmptyDataText="No data found."
ShowHeaderWhenEmpty="True">
</asp:GridView>
</asp:Panel>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnDownloadEnterpriceExcel" />
<asp:PostBackTrigger ControlID="btnUpload" />
</Triggers>
</asp:UpdatePanel>
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel ID="tpUBR" ClientIDMode="Static" HeaderText="UBR" runat="server" TabIndex="2">
<ContentTemplate>
2
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>

How to updatepanel with image

I want to use update panel with image.
When image select and show for preview then only update that part only.
<div class="field-block button-height">
<label for="file" class="label">
<b>Image</b> (*.jpg)
</label>
<table>
<tr>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<td>
<span class="input file">
<span class="file-text"></span>
<span class="button compact">Select file</span>
<asp:FileUpload ID="fuMovieLogo" runat="server" CssClass="file withClearFunctions />"
</span>
<br />
<small class="input-info">Max file size: 2MB</small>
<asp:Button ID="btnPreview" runat="server" Text="Preview" onclick="btnPreview_Click" />
<asp:Button ID="btnCancelprev" runat="server" Text="Cancel" onclick="btnCancelprev_Click"/>
</td>
<td style="padding-left:10px">
<asp:Image ID="imgTheatreLogo" runat="server" Width="130px" />
<br />
<asp:Label ID="lblupdatelogo" runat="server" CssClass="lbl" Visible="false" Text="FDMovieUntitled.jpg"></asp:Label>
</td>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnPreview" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnCancelprev" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</tr>
</table>
</div>
Please Help me.
So you just need to restructure your markup a little then. You need to place imgTheatreLogo inside the update panel. The triggers are actually handled by controls outside the update panel. See this documentation for reference on exactly how the UpdatePanel works.
<?xml version="1.0" encoding="utf-8"?>
<div class="field-block button-height">
<label for="file" class="label">
<b>Image</b> (*.jpg)
</label>
<table>
<tr>
<td>
<span class="input file">
<span class="file-text"></span>
<span class="button compact">Select file</span>
<asp:FileUpload ID="fuMovieLogo" runat="server" CssClass="file withClearFunctions />"
</span>
<br />
<small class="input-info">Max file size: 2MB</small>
<asp:Button ID="btnPreview" runat="server" Text="Preview" onclick="btnPreview_Click" />
<asp:Button ID="btnCancelprev" runat="server" Text="Cancel" onclick="btnCancelprev_Click"/>
</td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<td style="padding-left:10px">
<asp:Image ID="imgTheatreLogo" runat="server" Width="130px" />
<br />
<asp:Label ID="lblupdatelogo" runat="server" CssClass="lbl" Visible="false" Text="FDMovieUntitled.jpg"></asp:Label>
</td>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnPreview" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnCancelprev" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</tr>
</table>
</div>

Combobox selected item is deleted once selected . Invalid Postback or Callback argument

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]

Why does my ASP Server return this message

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.

Categories

Resources