ASP Modal Popup appears behind gridview after 3 clicks - asp.net

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;
}

Related

updatepanel for radiobuttonlist

I have a a couple of radiobuttonlists & checkboxlist that is currently set to AutoPostback=true inside an updatepanel. The async postback of updatepanel is working for checkboxlist but not for radiobuttonlists.
This is my code:
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="topBar$odsMainProduct" OnItemDataBound="Repeater1_ItemDataBound">
<ItemTemplate>
<div id="<%# Eval("main_product_id") %>" class="menu"></div>
<br></br>
<br></br>
<br></br>
<div class="divMainProduct">
<h2 style="font-weight: bold; font-stretch: ultra-expanded; margin-bottom: -4px"><%# Eval("name") %></h2>
<div style="margin-bottom: 10px">
<asp:Label ID="lblMainProductDescription" Font-Size="10px" EnableViewState="false" runat="server" Text='<%# Eval("description") %>'></asp:Label>
</div>
</div>
<div class="accordion" id="acc">
<asp:Repeater ID="Repeater2" runat="server" DataSourceID="odsMainProduct0" OnItemDataBound="Repeater2_ItemDataBound">
<ItemTemplate>
<div class="card">
<div class="card-header" id="h<%# Eval("product_id") %>" aria-expanded="false" data-toggle="collapse" data-target="#c<%# Eval("product_id") %>">
<asp:HiddenField ID="hfProductId" runat="server" Value='<%# Eval("product_id") %>' />
<asp:HiddenField ID="hfMainProductId" runat="server" Value='<%# Eval("main_product_id") %>' />
<table style="width: 100%;">
<tr>
<td style="width: 70%">
<asp:Label runat="server" Text='<%# Eval("name") %>' CssClass="linkbutton"></asp:Label>
<br />
<asp:Label runat="server" Text='<%# Eval("description") %>' Font-Size="8px" CssClass="linkbutton"></asp:Label>
</td>
<td style="width: 30%">
<asp:Button ID="btnHeaderSave" runat="server" ForeColor="White" Font-Bold="true" OnClick="btnHeaderSave_Click" BackColor="DarkRed" Font-Size="15px" Width="100px" Height="30px" Text="Button" />
</td>
</tr>
</table>
</div>
<div id="c<%# Eval("product_id") %>" class="collapse" aria-labelledby="h<%# Eval("product_id") %>" data-parent="#acc">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="card-body">
<asp:Panel runat="server" CssClass="pnl" GroupingText="Keuze grootte" Visible="false" ID="pnlSizes">
<asp:RadioButtonList ID="rdblSize" AutoPostBack="true" CssClass="checklist" OnSelectedIndexChanged="rdblSize_SelectedIndexChanged" runat="server"></asp:RadioButtonList>
</asp:Panel>
<asp:Panel runat="server" CssClass="pnl" GroupingText="Keuze bijgerecht" Visible="false" ID="pnlExtraOption">
<asp:RadioButtonList ID="rdblExtraOption" CssClass="checklist" runat="server"></asp:RadioButtonList>
</asp:Panel>
<asp:Panel runat="server" CssClass="pnl" GroupingText="Keuze garnering" Visible="false" ID="pnlGarnish">
<asp:CheckBoxList ID="chkGarnish" AutoPostBack="true" CssClass="checklist" OnSelectedIndexChanged="chkGarnish_SelectedIndexChanged" runat="server" RepeatColumns="4"></asp:CheckBoxList>
</asp:Panel>
<asp:Panel runat="server" CssClass="pnl" GroupingText="Keuze saus" Visible="false" ID="pnlSauce">
<asp:RadioButtonList ID="rdblSauce" AutoPostBack="true" CssClass="checklist" runat="server"></asp:RadioButtonList>
</asp:Panel>
<asp:Panel runat="server" CssClass="pnl" GroupingText="Keuze extra saus" Visible="false" ID="pnlExtraSauce">
<asp:RadioButtonList ID="rdblExtraSauce" AutoPostBack="true" CssClass="checklist" runat="server"></asp:RadioButtonList>
</asp:Panel>
<asp:Panel runat="server" CssClass="pnl" GroupingText="Keuze drank" Visible="false" ID="pnlDrink">
<asp:CheckBoxList ID="chklExtraDrink" AutoPostBack="true" CssClass="checklist" runat="server"></asp:CheckBoxList>
</asp:Panel>
<asp:Panel runat="server" CssClass="pnl" GroupingText="Keuze extra's" Visible="false" ID="pnlExtras">
<asp:CheckBoxList ID="chkExtras" CssClass="checklist" runat="server"></asp:CheckBoxList>
</asp:Panel>
<div style="margin-top: 10px; margin-bottom: 5px; text-align: center">
<asp:Button ID="btnSave" runat="server" ForeColor="White" Font-Bold="true" OnClick="btnSave_Click" BackColor="DarkRed" Font-Size="15px" Width="80%" Height="30px" Text="Button" />
<%--<input type="button" id="btnSave2" onclick="getid();" style="color: white; font-weight: bold; background-color: DarkRed; font-size: 15px; width: 100px; height: 30px" value="Button" />--%>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
<asp:ObjectDataSource ID="odsMainProduct0" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetProductsByMainProductId" TypeName="ProductBLL">
<SelectParameters>
<asp:Parameter Name="mainProductId" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</ItemTemplate>
</asp:Repeater>
Is this a limitation of UpdatePanel or am I doing something wrong here ?
This is the server-side code for radiobuttonlist rdblSize:
protected void rdblSize_SelectedIndexChanged(object sender, EventArgs e)
{
RepeaterItem row = ((RepeaterItem)((RadioButtonList)sender).NamingContainer);
Button btnSave = (Button)row.FindControl("btnSave");
btnSave.Text = "€" + getPrice(row);
}
protected Decimal getPrice(RepeaterItem ai)
{
HiddenField hfProductId = (HiddenField)ai.FindControl("hfProductId");
RadioButtonList rdbl = (RadioButtonList)ai.FindControl("rdblSize");
Decimal price = 0;
foreach (Product product in productList)
{
if (product.productId == Convert.ToInt32(hfProductId.Value))
{
if (rdbl != null && rdbl.SelectedValue != "")
{
if (product.priceId == Convert.ToInt32(rdbl.SelectedValue))
{
price = product.value;
}
}
else
{
if (product.priceId == Global.nvtPriceId)
{
price = product.value;
}
}
}
}
return price;
}
Seems like you have not set "AutoPostBack=true" for the radiobuttonlist. Set this property and try, should work.
Working for me with below code
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="card-body">
<asp:Panel runat="server" CssClass="pnl" GroupingText="Keuze extra saus" Visible="true" ID="pnlExtraSauce">
<asp:RadioButtonList ID="rd" AutoPostBack="true" CssClass="checklist" runat="server"></asp:RadioButtonList>
</asp:Panel>
<asp:Panel runat="server" CssClass="pnl" GroupingText="Keuze extra's" Visible="true" ID="pnlExtras">
<asp:CheckBoxList ID="chk" CssClass="checklist" AutoPostBack="true" runat="server"></asp:CheckBoxList>
</asp:Panel>
<div style="margin-top: 10px; margin-bottom: 5px; text-align: center">
<asp:Button ID="btnSave" runat="server" ForeColor="White" Font-Bold="true" OnClick="btnSave_Click" BackColor="DarkRed" Font-Size="15px" Width="80%" Height="30px" Text="Button" />
</div>
</div>
</ContentTemplate>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
rd.Items.Add(new ListItem("One", "1"));
rd.Items.Add(new ListItem("Two", "2"));
rd.Items.Add(new ListItem("Three", "3"));
chk.Items.Add(new ListItem("One", "1"));
chk.Items.Add(new ListItem("Two", "2"));
chk.Items.Add(new ListItem("Three", "3"));
}
}

Using button for the trigger, after can't click the button

Im using Button for some triggers, use the trigger but cant click, im remove the trigger, after button work but page header not displayed
look ate this
<asp:ImageButton ID="btnOderhelp" runat="server" OnClick="btnOderhelp_Click" ForeColor="White" ToolTip="Help" Height="25px" ImageUrl="~/img/help.png" />
<div class="col-md-12">
<div class="col-sm-2">
<asp:Label ID="Label2" runat="server" Text="Order No" Font-Bold="True" Font-Names="arial, helvetica, sans-serif" Font-Size="13px"></asp:Label>
</div>
<div class="col-sm-3">
<asp:TextBox ID="txtoder" MaxLength="15" runat="server" CssClass="form-control" Width="348px" placeholder="Oder Placement No/Style Name"></asp:TextBox>
<asp:HiddenField ID="hdnoder" runat="server"></asp:HiddenField>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtoder" CssClass="error" ErrorMessage="RequiredFieldValidator" Display="Dynamic" ValidationGroup="save" Font-Size="11px" ForeColor="Red">Order No Required!</asp:RequiredFieldValidator>
</div>
<div class="col-md-1" style="left: 30px;">
<asp:Label ID="Label8" runat="server" ForeColor="Red" Text="*"></asp:Label>
<asp:ImageButton ID="btnOderhelp" runat="server" OnClick="btnOderhelp_Click" ForeColor="White" ToolTip="Help" Height="25px" ImageUrl="~/img/help.png" />
...
</div>
...
</div>
I tried to use <asp:PostBackTrigger ControlID ="btnOderhelp" /> but it's not working for me, I can't click the button.
Make sure you have a <ScriptManager /> with
EnablePartialRendering="true"
Wrap the content you want to refresh
with a an UpdatePanel
Define your
Triggers
Exmaple
<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="True" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" ChildrenAsTriggers="true" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<div class="col-sm-2">
<asp:Label ID="Label2" runat="server" Text="Order No" Font-Bold="True" Font-Names="arial, helvetica, sans-serif" Font-Size="13px"></asp:Label>
</div>
<div class="col-sm-3">
<asp:TextBox ID="txtoder" MaxLength="15" runat="server" CssClass="form-control" Width="348px" placeholder="Oder Placement No/Style Name"></asp:TextBox>
<asp:HiddenField ID="hdnoder" runat="server"></asp:HiddenField>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtoder" CssClass="error" ErrorMessage="RequiredFieldValidator" Display="Dynamic" ValidationGroup="save" Font-Size="11px" ForeColor="Red">Order No Required!</asp:RequiredFieldValidator>
</div>
<div class="col-md-1" style="left: 30px;">
<asp:Label ID="Label8" runat="server" ForeColor="Red" Text="*"></asp:Label>
</div>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnOderhelp" />
</Triggers>
</asp:UpdatePanel>
<asp:ImageButton ID="btnOderhelp" runat="server" OnClick="btnOderhelp_Click" ForeColor="White" ToolTip="Help" Height="25px" ImageUrl="~/img/help.png" />
Please use ajax updatepanel or set on aspx page EnableEventValidation="false"
<div class="modal fade" role="dialog" id="eventdis" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<asp:UpdatePanel ID="updatedes" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Edit Voter Profile</h4>
</div>
<div class="modal-body">
<p>Mobile Number</p>
<asp:TextBox ID="txt_editVmobile" runat="server" CssClass="form-control placeholder-no-fix" placeholder="Mobile Number" autocomplete="off"></asp:TextBox>
<p>Status</p>
<asp:DropDownList ID="drp_edits" runat="server" CssClass="form-control"></asp:DropDownList>
<p>Caste</p>
<asp:DropDownList ID="drp_editc" runat="server" CssClass="form-control"></asp:DropDownList>
</div>
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-primary" type="button">Cancel</button>
<asp:Button ID="btn_EditVoterProfile" runat="server" Text="Submit" OnClientClick="return hindModel();" CssClass="btn btn-danger" OnClick="btn_EditVoterProfile_Click" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>

how to dynamically assign id to controls - controls are inside datalist in asp .net

I am using datalist for showing datas. Datas are test questions with 4 options.I have 50 questions displaying in datalist.
By using ItemDataBound event - i am making visible only one question with 4 options to user. Remaining questions are invisible . In the Itemdatabound event - i am assigning id to the radio buttons. but also id is not assigned to the datalist ,it showing different id.
<div class="widget">
<div class="widget-header" align="center" style="background: #4a98c9; color: #FFFFFF;">
<h4>
<asp:Label ID="Label5" runat="server" Text="Question : "></asp:Label>
<asp:Label ID="lblQuestionNo" runat="server" Text="0 of 0"></asp:Label></h4>
<asp:HiddenField ID="HdCurrentQuestSlNo" runat="server" />
<asp:HiddenField ID="HdfMinTime" runat="server" />
<asp:HiddenField ID="HdfSecTime" runat="server" />
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:HiddenField ID="HdfQSlNo" runat="server" />
<asp:HiddenField ID="HdQuestCount" runat="server" Value="0"/>
</div>
<div class="widget-content">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="PanelQuestBlock" runat="server" ScrollBars="Vertical" Width="100%" Height="325px">
<asp:DataList runat="server" ID="DataListQuestion"
onitemdatabound="DataListQuestion_ItemDataBound"
onitemcreated="DataListQuestion_ItemCreated">
<ItemTemplate>
<div class="questdisplayId" id="divQuestBlock" runat="server">
<div>
<asp:HiddenField ID='HdSlNo' runat="server" Value='<%# Eval("SlNo") %>' ClientIDMode="Static"/>
<asp:HiddenField ID="HdUserQuestId" runat="server" Value='<%# Eval("UserQuestionId") %>' ClientIDMode="Static"/>
<asp:HiddenField ID="HdTotalOptions" runat="server" Value='<%# Eval("TotalOptions") %>' ClientIDMode="Static"/>
<asp:HiddenField ID="HdQuestAnsweredTimeSecs" runat="server" Value='<%# Eval("AnsweredTimeSecs") %>' ClientIDMode="Static"/>
<asp:HiddenField ID="HdOptionAnswered" runat="server" Value='<%# Eval("OptionAnswered") %>' ClientIDMode="Static"/>
</div>
<div>
<asp:Label ID="Question" runat="server" Text='<%# Eval("Question") %>'></asp:Label>
</div>
<div class="answer-row" id="divOption1" runat="server">
<asp:RadioButton ID="Option1" runat="server" GroupName="Answer" value="1" Text='<%# Eval("Option1") %>'
CssClass="rdbtn" Style="vertical-align: middle" ClientIDMode="Static"/>
<asp:Label ID="lblOpt1" runat="server" Text=""></asp:Label>
</div>
<div class="answer-row" id="divOption2" runat="server">
<asp:RadioButton ID="Option2" runat="server" GroupName="Answer" value="2" Text='<%# Eval("Option2") %>'
CssClass="rdbtn" Style="vertical-align: middle" ClientIDMode="Static"/>
<asp:Label ID="lblOpt2" runat="server" Text=""></asp:Label>
</div>
<div class="answer-row" id="divOption3" runat="server">
<asp:RadioButton ID="Option3" runat="server" GroupName="Answer" value="3" Text='<%# Eval("Option3") %>'
CssClass="rdbtn" Style="vertical-align: top; left: auto;" ClientIDMode="Static"/>
<asp:Label ID="lblOpt3" runat="server" Text=""></asp:Label>
</div>
<div class="answer-row" id="divOption4" runat="server">
<asp:RadioButton ID="Option4" runat="server" GroupName="Answer" value="4" Text='<%# Eval("Option4") %>'
CssClass="rdbtn" Style="vertical-align: text-top" ClientIDMode="Static"/>
<asp:Label ID="lblOpt4" runat="server" Text=""></asp:Label>
</div>
<div class="answer-row" id="divOption5" runat="server">
<asp:RadioButton ID="Option5" runat="server" GroupName="Answer" value="4" Text='<%# Eval("Option5") %>'
CssClass="rdbtn" Style="vertical-align: text-top" ClientIDMode="Static"/>
<asp:Label ID="lblOpt5" runat="server" Text=""></asp:Label>
</div>
</div>
</ItemTemplate>
</asp:DataList>
</asp:Panel>
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<div class="row">
<div class="span8" align="center">
<asp:Button ID="btnClear" runat="server" Text="Clear Selection"
CssClass="btn btn-warning" OnClientClick="Clearbutton();"
/>
<asp:Button ID="btnSave" runat="server" Text="Save & Next" CssClass="btn btn-success" OnClientClick="Savebutton()"/>
</div>
<div class="span4" align="center">
<asp:Button ID="btnReview" runat="server" Text="Mark Review & Next" CssClass="btn btn-info" OnClientClick="Reviewbutton()"/>
<asp:Button ID="btnFinish" runat="server" Text="Finish" CssClass="btn btn-danger" OnClientClick="Finishbutton()"/>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnReview" />
<asp:AsyncPostBackTrigger ControlID="btnClear" />
<asp:AsyncPostBackTrigger ControlID="btnSave" />
</Triggers>
</asp:UpdatePanel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DataListQuestion" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
HiddenField HdSlNo = (HiddenField)e.Item.FindControl("HdSlNo");
RadioButton Option1 = (RadioButton)e.Item.FindControl("Option1");
RadioButton Option2 = (RadioButton)e.Item.FindControl("Option2");
RadioButton Option3 = (RadioButton)e.Item.FindControl("Option3");
RadioButton Option4 = (RadioButton)e.Item.FindControl("Option4");
RadioButton Option5 = (RadioButton)e.Item.FindControl("Option5");
Option1.ID = "rdbtnoption1_" + HdSlNo.Value.ToString();
Option2.ID = "rdbtnoption2_" + HdSlNo.Value.ToString();
Option3.ID = "rdbtnoption3_" + HdSlNo.Value.ToString();
Option4.ID = "rdbtnoption4_" + HdSlNo.Value.ToString();
Option5.ID = "rdbtnoption5_" + HdSlNo.Value.ToString();
}
In my design page code , using Datalist i am binding 50 questions . while binding itself i am hiding 2 to 50 questions . Question 1 only visible. I tried to give dynamic id for every questions and options using event databound and rowcreated. First it got error , after that i changed properties as ClientIDMode="Static" for controls.it shown different id. But if i click any button event again it clear the id's.again it shows old ids only.

Aligning .aspx buttons

I have an update panel that contains a label, a dropDownList and two buttons:
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="dropDownList" style="position:relative;" runat="server">
<label>
Select New File: </label>
<div id="ddl" runat="server">
<asp:DropDownList runat="server" ID="ddlCaseFiles" DataSourceID="dsMyCaseFiles" DataTextField="Display"
DataValueField="FileID" OnPreRender="ddl_PreRender" Width="524px" OnSelectedIndexChanged="ddlCaseFiles_SelectedIndexChanged" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlCaseFiles"
ToolTip="Casefile Required" InitialValue="-1" Text="*" Display="Dynamic" />
<ajaxToolkit:ListSearchExtender ID="ddlExtCaseFiles" runat="server" PromptCssClass="ListSearchExtenderPrompt"
TargetControlID="ddlCaseFiles" BehaviorID="ddlExtCaseFiles" Enabled="True" />
</div>
<br />
<asp:Button ID="btnMoveCaseFile" runat="server" Text=""
style="float:left;" onclick="btnMoveCaseFile_Click"/>
<asp:Button ID="btnCancel" runat="server" Text="Cancel"
style="float:right" onclick="btnCancel_Click"/>
<br />
</div>
<asp:Label runat="server" ID="lblStatus"></asp:Label>
</ContentTemplate>
I am trying to get my buttons to line up like this:(button at the beginning of the DropDownList and a button at the End)
I've tried float-absolute etc.
I figured it out. Seems as though you have to add in px after the number.....
<asp:Button ID="btnMoveCaseFile" runat="server" Text=""
style="position:absolute; float:left; margin-left:104px;" onclick="btnMoveCaseFile_Click"/>
<asp:Button ID="btnCancel" runat="server" Text="Cancel"
style="position:relative; float:right; margin-right:63px;"
since I had margin-right:63; instead of margin-right:63px;

popup is getting disaapeared after dropdown selection

<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).

Resources