While or For loop in asp.net - asp.net

How do I use a For loop in asp.net inside the below? I have tried to use <% for(int i=0; i<5; i++)%> which gives me syntax error.
I am getting tired of the message "Oops! Your edit couldn't be submitted because:"
<asp:ListView runat="server" ID="EmployeesListView" DataSourceID="EmployeesDataSource" DataKeyNames="EmployeeID" OnDataBound="grd_RowDataBound">
<LayoutTemplate>
<table cellpadding="2" runat="server" id="tblEmployees" name="tblEmployees" style="width:100%" color="green">
<tr id="Tr3" runat="server" style="background-color: red; color: yellow">
<th id="lbl1" style="display:none">Record No.</th>
</tr>
<tr runat="server" id="itemPlaceholder"></tr>
</table>
<asp:DataPager runat="server" ID="DataPager" PageSize="5">
<Fields>
<asp:NumericPagerField ButtonCount="5" PreviousPageText="<--" NextPageText="-->" />
</Fields>
</asp:DataPager>
</LayoutTemplate>
<ItemTemplate>
<td valign="top" class="tdWithBorder" width="165" align="right" style="background-color: #D7E0EC; color: blue">
<asp:Label ID="lblCallStatus" runat="server" Text='Call Status' />
<br />
<asp:Label ID="lblHoursWorked1" runat="server" Text='HoursWorked' />
<br />
<asp:Label ID="lblOTMealsPaid" runat="server" Text='Meals Paid'/>
<br />
</td>
</tr>
</ItemTemplate>

Look at the code-behind here
http://everymanprogrammer.com/index.php/nested-repeaters-do-it-clean-and-simple-a-beginners-tutorial-part-1/

Related

Listview Layout Template Error

I am querying a column from my db and when I test the query with the sqldatasource the numbers shows up fine. However, when I run the application, all the numbers in the column add two zeros at the end of it.
For example,
Instead of 1 it is 100
Instead of 2 it is 200
I dont know what the cause of this may be.
Here is my LayoutTemplate:
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table id="itemPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr runat="server" style="background-color: #E0FFFF;color: #333333; ">
<th runat="server"></th>
<th runat="server"> FormTitle</th>
<th runat="server">FormSection</th>
<th runat="server">SubSection</th>
<th runat="server">SectionItem</th>
<th runat="server">SortOrder</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="text-align: center;background-color: #5D7B9D;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF">
<asp:DataPager ID="DataPager1" runat="server" PageSize="7">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
ItemTemplate:
<ItemTemplate>
<tr style="background-color: #E0FFFF;color: #333333;">
<td>
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
</td>
<td>
<asp:Label ID="FormTitleLabel" runat="server" Text='<%# Eval("FormTitle") %>' />
</td>
<td>
<asp:Label ID="FormSectionLabel" runat="server" Text='<%# Eval("FormSection") %>' />
</td>
<td>
<asp:Label ID="SubSectionLabel" runat="server" Text='<%# Eval("SubSection") %>' />
</td>
<td>
<asp:Label ID="SectionItemLabel" runat="server" Text='<%# Eval("SectionItem") %>' />
</td>
<td>
<asp:Label ID="SortOrder" runat="server" Text='<%# Eval("SortOrder") %>' />
</td>
</tr>
</ItemTemplate>

Modal Pop up is not displaying update panel in asp.net

This is my aspx page:
<%# Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="TotalFee.aspx.cs" Inherits="TotalFee" %>
<%# Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script type="text/javascript">
// function ok(sender, e) {
// alert("Hello");
// __doPostBack('btnCreateBill','btnCreateBill_Click');
// }
// function cancel(sender, e) {
// $find('ModalPopupExtender1').hide();
// }
//
</script>
<style type="text/css">
.style2
{
font-size: x-large;
font-family: "Times New Roman", Times, serif;
}
.style3
{
color: #FF0000;
}
.panel
{
position:static;
top: 80%;
left:50%;
background-color:Aqua;
}
.modalBackground
{
z-index:auto;
}
</style>
</asp:Content>
<asp:Content ID="Content2" runat="server" contentplaceholderid="MainContent">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<table style="width:100%">
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="Classlabel" runat="server" Text="Class" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:DropDownList ID="ClassDropDownList" runat="server" Width="150px"
DataSourceID="SqlDataSource1" DataTextField="ClassName"
DataValueField="ClassName" AutoPostBack="True"
onselectedindexchanged="ClassDropDownList_SelectedIndexChanged">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbbilling2.0ConnectionString4 %>"
SelectCommand="SELECT [ClassName] FROM [tblClass]"></asp:SqlDataSource>
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="StudentNamelabel" runat="server" Text="StudentName" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:DropDownList ID="StudentNameDropDownList" runat="server" Width="150px"
DataSourceID="SqlDataSource2" DataTextField="StudentName"
DataValueField="StudentID" AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:dbbilling2.0ConnectionString3 %>"
SelectCommand="SELECT [StudentID], [StudentName] FROM [tblStudentInfo] WHERE ([Class] = #Class)">
<SelectParameters>
<asp:ControlParameter ControlID="ClassDropDownList" Name="Class"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="Monthlabel" runat="server" Text="Month" CssClass="style2"></asp:Label>
<br />
<br />
<br />
<br />
<br />
</td>
<td valign="top" align="center">
<asp:DropDownList ID="MonthDropDownList" runat="server" Width="150px"
DataSourceID="SqlDataSource3" DataTextField="Month" AutoPostBack="true"
DataValueField="Month" OnDataBound="MonthDropDownListDataBound"
onselectedindexchanged="MonthDropDownList_SelectedIndexChanged1">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:dbbilling2.0ConnectionString2 %>"
SelectCommand="SELECT [Month] FROM [tblMonth]"></asp:SqlDataSource>
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="MonthlyFeelabel" runat="server" Text="Monthly Fee" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtMonthlyFee" runat="server" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="MonthlyFeeValidator" runat="server"
ControlToValidate="txtMonthlyFee" CssClass="style3">*</asp:RequiredFieldValidator>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="TransportFeelabel" runat="server" Text="Transport Fee" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtTransportFee" runat="server" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="TransportationFeeValidator" runat="server"
ControlToValidate="txtTransportFee" CssClass="style3">*</asp:RequiredFieldValidator>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="Hostelfeelabel" runat="server" Text="Hostel Fee" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtHostelFee" runat="server" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="HostelFeeValidator" runat="server"
ControlToValidate="txtHostelFee" CssClass="style3">*</asp:RequiredFieldValidator>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="ECAFeeLabel" runat="server" Text="ECA Fee" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtECAFee" runat="server" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="ECAFeeValidator" runat="server"
ControlToValidate="txtECAFee" CssClass="style3">*</asp:RequiredFieldValidator>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:300px; vertical-align:top;" align="left" >
<asp:Label ID="DueFromPreviousMonthLabel" runat="server"
Text="Due From Previous Month" CssClass="style2"></asp:Label>
<br />
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtDueFromPreviousMonth" runat="server" Width="150px" Text="0"></asp:TextBox>
<asp:RequiredFieldValidator ID="DueFromPreviousMonthValidator" runat="server"
ControlToValidate="txtECAFee" CssClass="style3">*</asp:RequiredFieldValidator>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="TotalFeeLabel" runat="server" Text="Total Fee" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtTotalFee" runat="server" Width="150px" ReadOnly="true"></asp:TextBox>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="PaidLabel" runat="server" Text="Paid" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:CheckBox ID="ChkPaidLabel" runat="server" />
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
</td>
<td valign="top" align="right">
<asp:Button ID="btnSubmit" runat="server" Text="Submit" Width="150px"
onclick="btnSubmit_Click" />
<asp:Button ID="btnReset" runat="server" Text="Reset" Width="150px" />
<asp:Button ID="btnCreateBill" runat="server" Text="CreateBill" Width="150px"
OnClick="btnCreateBill_Click"/>
<%--<asp:PopupControlExtender ID="btnCreateBill_PopupControlExtender" OffsetX="-1100" OffsetY="115"
runat="server" DynamicServicePath="" Enabled="True" ExtenderControlID=""
TargetControlID="btnCreateBill" PopupControlID="UpdatePanel1">
</asp:PopupControlExtender>--%>
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" colspan="2" >
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ModalPopupExtender ID="ModalPopUpExtender1" runat="server" PopupControlID="UpdatePanel1"
TargetControlID="UpdatePanel1" DropShadow="false" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
<rsweb:ReportViewer ID="ReportingForPrintingReportViewer" runat="server" Visible="false" CssClass="panel"
Width="100%" Height="100%" Font-Names="Verdana" Font-Size="8pt"
InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana"
WaitMessageFont-Size="14pt">
<LocalReport ReportPath="Report.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource2" Name="DataSet1" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
SelectMethod="GetData" TypeName="DataSet1TableAdapters.tblTotalFeeTableAdapter">
</asp:ObjectDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</asp:Content>
and this is my cs page:
protected void btnCreateBill_Click(object sender, EventArgs e)
{
ModalPopUpExtender1.Show();
DisplayReport();
}
Why isn't UpdatePanel1 being displayed when we click btnCreateBill?? I want to show UpdatePanel1 as popup when i click btnCreateBill
When I placed modal pop up extender inside my updatepanel1 it gave the error
An extender can't be in a different UpdatePanel than the control it extends.
Because its outside the updatepanel, bring it inside the update panel to make it appear. You cannot access and change state of controls outside update panel when a event is fired in the update panel.
When a event is fired in a update panel, only controls in the update panel can be accessed and modified.
<td style="width:150px; vertical-align:top;" align="left" colspan="2" >
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ModalPopupExtender ID="ModalPopUpExtender1" runat="server" PopupControlID="UpdatePanel1" TargetControlID="UpdatePanel1" DropShadow="false" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
<rsweb:ReportViewer ID="ReportingForPrintingReportViewer" runat="server" Visible="false" CssClass="panel"
Width="100%" Height="100%" Font-Names="Verdana" Font-Size="8pt"
InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana"
WaitMessageFont-Size="14pt">
<LocalReport ReportPath="Report.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource2" Name="DataSet1" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
SelectMethod="GetData" TypeName="DataSet1TableAdapters.tblTotalFeeTableAdapter">
</asp:ObjectDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</td>
instead of using updatepanel on modalpopup panel you can try something from code behind to serve the purpose.
<asp:scriptmanager id="ScriptManager1" runat="server">
</asp:scriptmanager>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="modalBackground"
CancelControlID="btnCancel" PopupControlID="Panel1"
TargetControlID="HiddenField1">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="Panel">
<asp:RadioButtonList ID="RadioButtonList1" runat="server" Height="34px" RepeatDirection="Horizontal"
Width="129px" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"
AutoPostBack="True">
<asp:ListItem>Option1</asp:ListItem>
<asp:ListItem>Option2</asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="txt1" runat="server"
Visible="False"></asp:TextBox>
<asp:TextBox ID="txt2" runat="server"
Visible="False"></asp:TextBox>
</asp:Panel>
===========================================
Code Behind:
===========================================
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex == 0)
{
txt1.Visible = true;
ModalPopupExtender1.Show();
}
else
{
txt2.Visible = true;
ModalPopupExtender1.Show();
}
}

Default button not triggered in Panel

Whys is not lblMasterPhoneNumbers onclick method trigger when i press enter in the textbox?
<asp:Panel ID="pnlSearch" DefaultButton="lbMasterPhoneNumber" runat="server">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<asp:TextBox ID="txtSearchMaster" runat="server" CssClass="TextBoxSearchActive" EnableTheming="false" />
</td>
<td>
<%--<asp:Button ID="btnSearchMaster" CssClass="SearchButton" runat="server" OnClick="btnSearchMaster_Click" CausesValidation="false" EnableTheming="False" />--%>
</td>
</tr>
<tr>
<td colspan="2">
<div style="margin-right:3px; color:white">
<asp:LinkButton ID="lbMasterPhoneNumber" runat="server" Text="Phone number" ForeColor="White" onclick="lbMasterPhoneNumber_Click" OnClientClick="javascript:ActivateLoadingIndicator()" /> |
<asp:LinkButton ID="lbMasterCDR" runat="server" Text="CDR" ForeColor="White" onclick="lbMasterCDR_Click" /> |
<asp:LinkButton ID="lbMasterSMS" runat="server" Text="SMS" ForeColor="White" onclick="lbMasterSMS_Click" />
</div>
</td>
</tr>
</table>
</asp:Panel>
msdn states that defaultbutton property does not support linkbutton http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.panel.defaultbutton.aspx

How can I relocate ListView

I have a ListView in the design view,,but I cant move it with an absolute css attribute.
Is there a way to move it on a page?
<asp:ListView ID="ListView1" runat="server" DataKeyNames="MessageID"
DataSourceID="SqlDataSource1" onitemcommand="ListView1_ItemCommand"
style="z-index: 1; left: 452px; top: 429px; position: absolute; height: 271px; width: 221px; margin-top: 0px">
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table ID="itemPlaceholderContainer" runat="server" border="1"
style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr runat="server" style="background-color: #FFFBD6;color: #333333;">
<th runat="server">
MessageTitle</th>
</tr>
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server"
style="text-align: center;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
<AlternatingItemTemplate>
<tr style="background-color: #FAFAD2;color: #284775;">
<td>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select">'<%# Eval("MessageTitle") %>'</asp:LinkButton>
</td>
</tr>
</AlternatingItemTemplate>
<EditItemTemplate>
<tr style="background-color: #FFCC66;color: #000080;">
<td>
<asp:Button ID="UpdateButton" runat="server" CommandName="Update"
Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Cancel" />
</td>
<td>
<asp:TextBox ID="MessageTitleTextBox" runat="server"
Text='<%# Bind("MessageTitle") %>' />
</td>
</tr>
</EditItemTemplate>
<EmptyDataTemplate>
<table runat="server"
style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
<tr>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="InsertButton" runat="server" CommandName="Insert"
Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Clear" />
</td>
<td>
<asp:TextBox ID="MessageTitleTextBox" runat="server"
Text='<%# Bind("MessageTitle") %>' />
</td>
<td>
</td>
</tr>
</InsertItemTemplate>
<ItemTemplate>
<tr style="background-color: #FFFBD6;color: #333333;">
<td>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select" >'<%# Eval("MessageTitle") %>'</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<SelectedItemTemplate>
<tr style="background-color: #FFCC66;font-weight: bold;color: #000080;">
<td>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select">'<%# Eval("MessageTitle") %>'</asp:LinkButton>
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:CP_AllQuestionsAnswered %>"
SelectCommand="GetMessagesTitles" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="Name" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
What a problem:
div.ListView1
{
position: absolute;
left: 100;
top: 100;
}
<asp:ListView runat="server" ID="ListView1" ItemPlaceholderID="itemPlaceholder">
<LayoutTemplate>
<div class="ListView1">
<asp:PlaceHolder runat="server" ID="itemPlaceholder" />
</div>
</LayoutTemplate>
<ItemTemplate>
<%# Container.DataItem.ToString() %>
<br />
</ItemTemplate>
</asp:ListView>
Ok, your problem is that you set ListView's style attribute when you need specify this attribute for the table in the LayoutTemplate.

Update panel Postback

I Have A web Page Having Two TextBox and Two Image Button on Image Button Click
open the ModalPopupExtender having Grid inside the ModelPopExtender. mean Grid Pop open on image button CLick. Problem is That when i click the button It show ModelPopExtender and Close.
auto and Page Post Back and Again Pop open. I want that pop is open stage not to post back.
aspx Code is like:
"
<asp:ImageButton ID="imgbtnExpenseGL" runat="server" ImageUrl="../../Images/icon_popup.gif" ImageAlign="Top" OnClientClick="ShowPopupExpGLSearch();" />
<AjaxToolKit:AutoCompleteExtender
ID="AutoCompleteExtender1"
runat="server"
CompletionInterval="100"
CompletionSetCount="12"
EnableCaching="false"
MinimumPrefixLength="1"
ServiceMethod="GetGLAccountList"
TargetControlID="txtExpenseGL"
>
</AjaxToolKit:AutoCompleteExtender>
<AjaxToolKit:ModalPopupExtender
ID="ModalPopupExtender1"
runat="server"
BackgroundCssClass="modalBackground"
CancelControlID="btnCancelCountry"
DropShadow="true"
PopupControlID="divExpenseGLSearch"
TargetControlID="imgbtnExpenseGL">
</AjaxToolKit:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>"
Thier two update panel like that having same code.
and This Grid Bind div Code:
<div id="divAccountGLSearch" class="popup" style="display: none; width: 350px;">
<table width="98%" align="center" border="0" cellpadding="0" cellspacing="0" style="height: 320px;">
<%-- For Heading and Image and CloseDiv --%>
<%-- Row 1 For Header Text --%>
<tr>
<th>
<h1>
List of Pre-Paid Account GL
</h1>
</th>
<td align="right" valign="top" style="padding-top: 6px;">
<img onclick="CloseDiv();" src="../../Images/close.gif" border="0" />
</tr>
<%-- Row 2 For Find TextBox and Find Button --%>
<tr>
<td class="form-label" style="padding-left: 5px;width:70%;">
Search
<asp:TextBox ID="txtFindPrePaidExpenses" runat="server" onBlur="javascript:setpopupfocus();" ></asp:TextBox>
</td>
<td align="left" style="width:30%;">
<table>
<tr>
<td>
<asp:LinkButton ID="btnFindCountry" CssClass="button" runat="server"
OnClientClick="ShowPopupAccGLSearch();" onclick="btnFindCountry_Click">
<span>Find</span></asp:LinkButton>
</td>
</tr>
</table>
</td>
</tr>
<%-- Row 3 For Repater Control --%>
<tr>
<td colspan="2" align="center">
<div style="overflow: auto; height: 280px; width: 100%;">
<asp:GridView ID="gvSearchAccountGL" runat="server" AutoGenerateColumns="False"
Width="98%" CssClass="table-grid" border="0" CellPadding="0"
CellSpacing="0" onrowdatabound="gvSearchAccountGL_RowDataBound"
>
<Columns>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:HiddenField ID="hfIndex" runat="server" Value='<%# Container.DataItemIndex + 1 %>'/>
</ItemTemplate>
<HeaderStyle HorizontalAlign="left" />
<ItemStyle HorizontalAlign="left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Account GL">
<ItemTemplate>
<asp:Label ID="lblAccountGLCode" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ACM_ACCOUNT_CODE")%>' ></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="left" />
<ItemStyle HorizontalAlign="left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Account Description">
<ItemTemplate>
<asp:Label ID="lblAccountGLDescription" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ACM_ACCOUNT_DESC")%>' ></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="left" />
<ItemStyle HorizontalAlign="left" />
</asp:TemplateField>
</Columns>
<RowStyle CssClass="gridRow" />
<HeaderStyle CssClass="gridHeader" />
<SelectedRowStyle BackColor ="Gray" />
</asp:GridView>
</div>
</td>
</tr>
<%-- Row 4 For Space Image --%>
<tr>
<td colspan="2">
<img src="../../Images/spacer.gif" border="0" class="seprator" />
</td>
</tr>
<%-- Row 5 For OK and Cancel Button --%>
<tr>
<td colspan="2">
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td>
<asp:LinkButton ID="btnOKPrePaidExpense" CssClass="button" runat="server"
onclick="btnOKPrePaidExpense_Click">
<span>OK</span></asp:LinkButton>
</td>
<td>
</td>
<td>
<asp:LinkButton ID="btnCancelPrePaidExpense" CssClass="button" runat="server">
<span>Cancel</span></asp:LinkButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
My div Bind Code is Out off Update Panel Code.
so how to stop postback and Stable Pop Control
Thank U
To prevent the ImageButton control from automatically posting back when it's clicked, your ShowPopupExpGLSearch() function should return false.

Resources