popup is getting disaapeared after dropdown selection - asp.net

<asp:Panel id="container" CssClass="container" runat="server" style="width:850px">
<asp:Panel runat="server" id="header" cssClass="header" >
<div class="msg"> </div>
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="close" OnClientClick="clearDataKey()" />
</asp:Panel>
<div runat="server" id="whatup">
<asp:Panel ID="Panel2" runat="server" >
<uc1:messageBox ID="InfoBox" runat="server" />
</asp:Panel>
</div>
<asp:updatepanel ID="upcsconfirmation" runat="server">
<ContentTemplate>
<cc1:ModalPopupExtender ID="popupCS" runat="server" BehaviorID="popupCS" TargetControlID="btnTargetCS"
PopupControlID="pnlPopupCS" BackgroundCssClass="modalBackground"/>
<asp:Button ID="btnTargetCS" runat="server" Text="Button" cssClass="hide" />
<cc1:DragPanelExtender ID="DragPanelExtenderCS" TargetControlID="pnlPopupCS" runat="server"></cc1:DragPanelExtender>
<asp:Panel ID="pnlPopupCS" runat="server" SkinID="modal"></asp:Panel>
</ContentTemplate>
</asp:updatepanel>
<div class="body" >
<div class="contentarea" style="height:200px;">
<asp:TextBox ID="datakeyholder" runat="server" style="display:none" Enabled="False" />
<asp:ObjectDataSource ID="odsCopyCustRequirements" runat="server" InsertMethod="InsertSearchRequirement"
TypeName="SearchRequirementsDataObject"
oninserting="Requirements_Inserting" >
</asp:ObjectDataSource>
<div style="height: 100%; width: 100%">
<div id="Div1" style="float: left; width: 45%; padding-left:10px">
<div class="column130">
<asp:Label ID="lblSearch1" runat="server" Text="FAST Region:"></asp:Label></div>
<asp:UpdatePanel ID="UpnlCust" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<div class="column130">
<asp:DropDownList ID="ddSearch1" AutoPostBack="true" DataTextField="Name"
OnSelectedIndexChanged="ddSearch_SelectedIndexChanged" DataValueField="id"
runat="server" Width="150px">
</asp:DropDownList>
</div>
<div class="column130">
<asp:Label ID="lblSearch2" runat="server" Text="Owning Office:"></asp:Label></div>
<div class="column130">
<asp:DropDownList ID="ddSearch2" DataTextField="Name" DataValueField="fastid"
runat="server" Width="150px">
</asp:DropDownList>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddSearch1" />
</Triggers>
</asp:UpdatePanel>
<div class="column">
</div>
</div>
</div>
</div>
<p></p>

The upper update panel (upcsconfirmation) containing modal popup extender should have UpdateMode = "Conditional" - otherwise, asynchronous post-back from bottom update panel will also update its content restoring the modal popup to hidden state.
Yet another way to solve your issue is to use Show method of popup extender on server side when the bottom update panel posts back (for example, you can put the call popupCS.Show() in ddSearch_SelectedIndexChanged to keep the modal popup open).

Related

how to maintain DIV scroll bar position in Listview ASP.net

my problem is when i click the imagebutton ("imgEdit") in the listview the scroll bar of my listview doesnt stay in the position where i click it.
heres my code:
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:ListView ID="LV_Profile" runat="server" GroupItemCount="1" GroupPlaceholderID="groupPlaceHolder1"
ItemPlaceholderID="itemPlaceHolder1" OnItemDataBound="LV_Profile_ItemDataBound" OnSelectedIndexChanged="LV_Profile_SelectedIndexChanged" >
<LayoutTemplate>
<div id ="mainprofile" style="overflow-x: scroll; margin: 0 65px;" runat="server">
<div id="subdivprof" runat="server" style="height: inherit; width: 3400px; margin: 10px 0;">
<asp:PlaceHolder runat="server" ID="groupPlaceHolder1"></asp:PlaceHolder>
</div>
</div>
</LayoutTemplate>
<GroupTemplate>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder1"></asp:PlaceHolder>
</GroupTemplate>
<ItemTemplate>
<div class="divprofile">
<div id="proftools" class="tools" runat="server">
<asp:ImageButton ID="imgCancel" CssClass="img"
ImageUrl="~/images/Delete-52 (1).png" runat="server" alt=""
ToolTip="Cancel edit" Visible="False" OnClick="DoneEdit" />
<asp:ImageButton ID="imgDone" CssClass="img"
ImageUrl="~/images/Checkmark-52.png" runat="server" alt=""
ToolTip="Done edit" Visible="False" />
<asp:ImageButton ID="imgEdit" CssClass="img" ImageUrl="~/images/Edit User Male-52.png"
runat="server" alt="" ToolTip="Edit profile" OnClick = "EditUser" />
<asp:ImageButton ID="imgEmail" CssClass="img" ImageUrl="~/images/-Message Filled-52.png"
runat="server" alt="" ToolTip="Send an email" />
</div>
<div id="proginfo" runat="server">
<div class="level"><%#Eval("Prog_Pos")%></div>
<div class="pic"><asp:ImageButton ID="ImageButton1" CssClass="img" runat="server" onclick="FindUser" OnClientClick="return chooseFile();" ToolTip='<%#Eval("Idno")%>' Enabled="False" /></div>
<div class="nickname"><asp:Textbox ID="txtNickname" runat="server" Text='<%#Eval("NickName") %>' CssClass="txt" Enabled="false" style="margin-top:10px;"></asp:Textbox></div>
<div class="name"><asp:TextBox ID="txtName" runat="server" Text='<%#Eval("Name")%>' CssClass ="txt" Enabled="false" ></asp:TextBox></div>
<div class="email"><asp:Textbox ID="txtEmail" runat="server" Text='<%#Eval("emailAddress")%>' CssClass="txt" Enabled="false"></asp:Textbox></div>
</div>
</div>
</ItemTemplate>
</asp:ListView>
</ContentTemplate>
</asp:UpdatePanel>
Thanks in advance. :)
You need after update return list position.
Add in .aspx
<asp:HiddenField id="scrollPosition" runat="server"/>
Next you need in JS
find this hiddenfield
var hdField = document.getElementById(<%=scrollPosition.ClientID%>);
find list
var list= document.getElementById('LV_Profile');
OnScroll event set value to your HiddenField
list.onscroll = function() {
hdField .value = list.scrollTop;
}
When window or document is onload return saved position
window.onload = function () {
list.scrollTop = hdField.value;
}

ASP Modal Popup appears behind gridview after 3 clicks

I have a page with multiple modal popups and a gridview. If i open the popups 3 times the grid goes infront of the popup. I am pretty sure it has somethign to do witht eh update panels but i am stumped.
Here is the Code
<asp:UpdatePanel ID="NewCustCarUP" runat="server">
<ContentTemplate>
<asp:button ID="NewCustButton" runat="server" CssClass="btn btn btn-success" text="Add Customer" OnClick="NewCustButton_Click"/>
<asp:button ID="NewCarButton" runat="server" CssClass="btn btn btn-primary" text="Add Carrier" OnClick="NewCarButton_Click"/>
<!-- MP ADD CUST -->
<asp:LinkButton ID="lnkFake" runat="server"></asp:LinkButton>
<cc1:ModalPopupExtender ID="mpAddCust" runat="server" PopupControlID="NewCustPanel" TargetControlID="lnkFake"
CancelControlID="btnClose" BackgroundCssClass="modalBackground" RepositionMode="RepositionOnWindowResizeAndScroll">
</cc1:ModalPopupExtender>
<asp:Panel ID="NewCustPanel" runat="server" CssClass="modalPopup" style = "display: none; width:65%; height:90%; overflow:scroll; ">
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-4"><br />
<asp:Button ID="newCustInsert" runat="server" UseSubmitBehavior="false" OnClick="newCustInsert_Click" CssClass="btn btn-success" ValidationGroup="NewCust" Text="Add Customer" />
<asp:Button ID="btnClose" runat="server" Text="Close" CssClass="btn btn-danger" />
</div>
<div class="col-sm-4 col-md-4 col-lg-4"></div>
</div>
</asp:Panel>
<!-- END MP ADD CUST -->
<!-- MP ADD CARRIER -->
<asp:LinkButton ID="lnkFake1" runat="server"></asp:LinkButton>
<cc1:ModalPopupExtender ID="mpAddCar" runat="server" PopupControlID="NewCarPanel" TargetControlID="lnkFake1"
CancelControlID="btnCloseCar" BackgroundCssClass="modalBackground" RepositionMode="RepositionOnWindowResizeAndScroll">
</cc1:ModalPopupExtender>
<asp:Panel ID="NewCarPanel" runat="server" CssClass="modalPopup" style = "display: none; width:65%; height:90%; overflow:scroll; ">
<div class="row">
<div class="col-sm-4">
.....Code with textboxes</div>
<div class="col-sm-4">
<asp:Button ID="InsertCarBtn" runat="server" Text="Add Carrier" CssClass="btn btn-success" OnClick="InsertCarBtn_Click" ValidationGroup="NewCar" />
<asp:Button ID="btnCloseCar" runat="server" Text="Close" CssClass="btn btn-danger" />
</div>
<div class="col-sm-4 col-md-4 col-lg-4"></div>
</div>
</asp:Panel>
<!-- END MP ADD CARRIER -->
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="MPStatusUP" runat="server">
<ContentTemplate>
<asp:panel ID="StatusPanel" runat="server" CssClass="modalPopup" style="z-index: 10000; position: relative;" >
<div class="row">
<div class="col-sm-4">
....Content
</div>
<div class="col-sm-4">
<asp:button ID="StatusbtnUpdate" runat="server" Text="Update" CssClass="btn btn-success" OnClick="StatusbtnUpdate_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="btn btn-danger" OnClientClick = "return Hidepopup()"/>
</div>
<div class="col-sm-4 col-md-4 col-lg-4"></div>
</div>
</asp:panel>
<asp:LinkButton ID="lnkFake3" runat="server"></asp:LinkButton>
<cc1:ModalPopupExtender ID="StatusMP" runat="server" DropShadow="false"
PopupControlID="StatusPanel" TargetControlID = "lnkFake3"
BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="Gridview1UP" runat="server" ChildrenAsTriggers="true"
UpdateMode="Conditional">
<ContentTemplate>
<asp:gridview ID="GridView1" runat="server"
DataSourceID="ActiveLoadsSQL" AutoGenerateColumns="False" BorderStyle="None" BorderWidth="0px" Width="100%"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowDataBound="GridView1_RowDataBound"
DataKeyNames="LoadID" AllowSorting="true" AllowPaging="true" Font-Size="Smaller" CssClass="table table-hover"
pagesize="25">
<Columns>
<asp:TemplateField HeaderText="loadID" InsertVisible="False" SortExpression="loadID">
<ItemTemplate>
<asp:Label ID="loadIDLabel" runat="server" Text='<%# Bind("loadID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:Button ID="UpdateStatusModalbtn" OnClick="UpdateStatusModalbtn_Click" runat="server" CommandName="select" CssClass="btn btn-info btn-xs" text="Update"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle VerticalAlign="Top" />
</asp:gridview>
</ContentTemplate>
</asp:UpdatePanel>
It all works great until i get i click on a button 3 times on the status modal inside the GV and 4 times on the Add Customer and carrier outside of the GV. Thanks for your help!!
Fixed with this post
AJAX ModalPopup Pops Behind (Under) Page Content (Negative z-index)
.ModalPopup
{
z-index: 6001 !important;
}
.ModalPopupBackground
{
z-index: 6000 !important;
}

Asp tabpanel updating all tabs

I am working on a webpage that displays online users in a TabPanel, and I want to have it update every X amount of seconds. This part works; however, all of the other tabs in the TabContainer will update too, which I do not want. Here is the code for the online user tab
<cc1:TabPanel runat="server" HeaderText="Online Users" ID="TabPanel1">
<ContentTemplate>
<div>
<div style="position:relative; text-align:left; width:650px; top: 0px; left: 0px;">
<asp:Label ID="lblUpdate" runat="server" Text="This page refreshed automatically every 10 seconds, or press the update button to the right"></asp:Label>
</div>
</div>
<asp:Timer runat="server" ID="timer1" Interval="10000"></asp:Timer>
<asp:Timer runat="server" ID="timer2" Interval="9000"></asp:Timer>
<asp:UpdatePanel runat="server" ID="updateOnlineUsers" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="timer1" />
<asp:AsyncPostBackTrigger ControlID="timer2" />
</Triggers>
<ContentTemplate>
<div style="text-align:right; position:relative; top:-20px">
<asp:Image style="position:relative; display:none; z-index:1" ID="Image1" runat="server" ImageUrl="../images/reload.gif" />
<asp:ImageButton ID="ImageButton1" style="position:relative; z-index:2" runat="server" ImageUrl="../images/reload5.png" />
</div>
<div>
<asp:Label ID="lbluserCount" runat="server"></asp:Label>
</div>
<div>
<asp:Label ID="lblOfflineUsers" runat="server"></asp:Label>
</div>
<div>
<asp:Label runat="server" ID="lblOnlineUsers">Hi Everybody</asp:Label>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</cc1:TabPanel>
Thanks in advance!
Move timers out of TabPanel. Possibly you'll need to register timers as AsyncPostbackTriggers manually from code-behind after that.

AsyncFileUpload in UpdatePanel

I want to use a update panel to update my repeater when I click om my btnUpload.
When I put my ascynFileUpload in the updatePanel is stop working, though the codebehind is ok.
But when I set my btnUpload as trigger and only put my repeater in the updatepanel, it doesn't refresh (which is good) but my codebehind stops working.
<div id="addEntry" class="row centered" runat="server">
<asp:Label ID="lblFeedback" runat="server"></asp:Label>
<abbr title="Max 20MB">
<asp:AsyncFileUpload ID="uploadEntry" runat="server" CompleteBackColor="White" />
</abbr>
<div id="uploading">
</div>
<asp:TextBox ID="txtEntryDescription" runat="server" TextMode="MultiLine" placeholder="Description upload (optional)"
Width="100%" Height="60px"></asp:TextBox><br />
<asp:Button ID="btnAddEntry" runat="server" Text="Upload" CssClass="btn btn-round"
OnClick="btnAddEntry_Click" />
<hr />
</div>
<div id="competitionRounds" class="row">
<asp:UpdatePanel ID="updatepnl" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Repeater ID="rptEntries" runat="server" DataSourceID="dsEntries">
<ItemTemplate>
<%# "<div class=\"imgThumb" + Eval("entryWinner") + " draggable\" style=\"background-image:url('uploads/"
+ Eval("entryImagename") + "');\" data-id=\""
+ Eval("pk_entryId") + "\"></div>"
%>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAddEntry" EventName="click" />
</Triggers>
</asp:UpdatePanel>
</div>

Ajaxcontoltoolkit tab container not displaying alongisde modal popup extender

I'm using VS2010, C#, ASP.NET, I've inserted Ajax Control Toolkit Tab Container which works great, but when I insert a modal popup extender on another panel, tabs do not display! what is going wrong here? How can I have both on them as both are really cool effects
thanks
my tab container:
<cc1:TabContainer runat="server" ID="Tabs" CssClass="visoft__tab_xpie7"
ActiveTabIndex="2" Width="100%" Height="160px">
<cc1:TabPanel runat="server" ID="tab1" HeaderText="برنامه نویسی وب و اتوماسیون">
<HeaderTemplate>
<div >
<asp:Image ID="Image12" BorderStyle="None" runat="server" ImageUrl="~/Images/internet.png" /><br />
وب و اتوماسیون
</div>
</HeaderTemplate>
<ContentTemplate>
<div runat="server" id="divTab1" style="direction:rtl;">
</div>
</ContentTemplate>
<cc1:TabPanel runat="server" ID="tab2" HeaderText="تله متری" >
<HeaderTemplate>
<div >
<asp:Image ID="Image11" BorderStyle="None" runat="server" ImageUrl="~/Images/telemetry.png" /><br />
تله متری
</div>
</HeaderTemplate>
<ContentTemplate>
<div runat="server" id="divTab2" style="direction:rtl;">
</div>
<cc1:TabPanel runat="server" ID="tab3" HeaderText="">
<HeaderTemplate>
<div >
<asp:Image ID="Image10" BorderStyle="None" runat="server" ImageUrl="~/Images/mb.png" /><br />
موبایل، گرافیک، بازی
</div>
</HeaderTemplate>
<ContentTemplate>
<div runat="server" id="divTab3" style="direction:rtl;">
</div>
</ContentTemplate>
<cc1:TabPanel runat="server" ID="TabPanel1" HeaderText="">
<HeaderTemplate>
<div >
<asp:Image ID="Image13" BorderStyle="None" runat="server" ImageUrl="~/Images/flash.png" /><br />
انیمیشن و فلش
</div>
</HeaderTemplate>
<ContentTemplate>
<div runat="server" id="divTab4" style="direction:rtl;">
</div>
</ContentTemplate>
my modal popup extender:
<asp:Panel ID="pnlNews1" runat="server" CssClass="modalPopup" >
<div style="height:100% ; overflow:auto; width: 100%; top:0px; bottom:0px">
<asp:Table ID="Table10" Height="32px" Width="100%" runat="server">
<asp:TableRow HorizontalAlign="Left">
<asp:TableCell>
<asp:ImageButton ID="btnClose1" ToolTip="بستن کادر" runat="server" ImageUrl="~/Images/close.png" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow HorizontalAlign="Right">
<asp:TableCell>
<asp:Label ID="lblTitle1" runat="server" Font-Names="Tahoma" Text="Label"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<div runat="server" id="divBody1">
</div>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
I don't know if this helps, but I had a very similar problem. I had some tabs working, then added a modalpopup extender and a panel, and suddendly my tabs dissappeared.
In my case, my modal popup panel's Visible property was set to "False" (which is not really necessary). Like this:
<asp:Panel ID="ModalPopupPanel" runat="server" CssClass="ModalPopupPanel" Visible="False">
When I deleted this property, the Tabs appeared. So it looks now like this:
<asp:Panel ID="ModalPopupPanel" runat="server" CssClass="ModalPopupPanel">
I know you are not setting this property, but maybe you can try something like this to find what is causing the problem?
Sorry I cannot be of any more help.

Resources