Update panel with each row in repeater - asp.net

I have repeater and when i put update panel in each row its still loading all other update panels is there any reason for this?
It should only update that part only that is i want to achieve.
<asp:Repeater runat="server" ID="grd" >
<HeaderTemplate>
<table class=" table-serviceline table table-hover table-bordered">
</HeaderTemplate>
<ItemTemplate>
<tr class="service-line-item" id="<%#"serviceline"+ Eval("ClaimServiceID") %>">
<td class="fw65">
<table class="table-small-pad">
<tr>
<td>
<asp:Label ID="lblID" ClientIDMode="Static" Text='<%#Container.ItemIndex+1 %>' runat="server"></asp:Label>
</td>
</tr>
</table>
</td>
<td class="fw150">
<table class="table-small-pad">
<tr>
<td>
<asp:UpdatePanel ID="upd" runat="server">
<ContentTemplate>
<div class="input-group">
<asp:TextBox ID="txtCODE" runat="server" CssClass="form-control" Text='<%# Bind("Code") %>' ToolTip="Code" MaxLength="15" />
<span class="input-group-addon"></span>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

I believe that the combo of
UpdateMode="Conditional"
and
ChildrenAsTriggers="True"
in the UpdatePanel is what you are looking for. If you don't set the first parameter, UpdatePanels update on any postback.

Related

Control inside repeater causing full postback even after keeping in update panel

In my page, I have one search button and a repeater. I have wrapped everything inside UpdatePanel. My search button do not causes full postback, i.e ideal but RadioButtonList inside Repeater control does. I have no idea what to do.
<asp:UpdatePanel ID="up" runat="server">
<ContentTemplate>
<table align="center" border="1" cellspacing="0" class="tabmn6">
<tr id="trheader" runat="server">
<th id="trEdit" runat="server">Edit</th>
<th>User Name </th>
<th>Role</th>
<th>From Date</th>
<th>To Date</th>
<th>Comment</th>
<th>Status</th>
</tr>
<asp:Repeater ID="rpUserDetails" runat="server" OnItemDataBound="rpUserDetails_ItemDataBound">
<ItemTemplate>
<tr>
<td id="tdRPEdit" runat="server" align="center">
<input type="button" class="editbtn" name="btnEdit" id="btnEdit" runat="server" onclick='<%# string.Format("javascript:return AddBoardCast(\"{0},{1}\")", Eval("BC_ID"),"Edit") %>'>
</td>
<td id="trRPTL" runat="server" align="center">
<asp:Label ID="lblUName" runat="server" ForeColor="Red" Text='<%#Eval("UserName")%>' />
</td>
<td align="center">
<asp:Label ID="lblRoleName" runat="server" ForeColor="Black" Text='<%#Eval("RoleName")%>' />
</td>
<td align="center">
<asp:Label ID="lblToDate" runat="server" ForeColor="Black"><%#DataBinder.Eval(Container.DataItem, "BC_FromDate", "{0:dd/MM/yyyy}")%></asp:Label>
</td>
<td align="center"><asp:Label ID="lblFromDate" runat="server" ForeColor="Black"><%#DataBinder.Eval(Container.DataItem, "BC_TODate", "{0:dd/MM/yyyy}")%></asp:Label></td>
<td align="center" width="20%">
<div style="color: black"><%#Eval("BC_Comment")%></div>
</td>
<td align="center">
<asp:HiddenField ID="hdnBC_ID" runat="server" Value='<%#Eval("BC_ID") %>' />
<asp:HiddenField ID="hdnUserID" runat="server" Value='<%#Eval("UserID") %>' />
<asp:RadioButtonList ID="rdStatus" runat="server" Height="48px" RepeatDirection="Horizontal" AutoPostBack="true" OnSelectedIndexChanged="rdStatus_SelectedIndexChanged" CssClass="rad">
<asp:ListItem Text="Active" Value="1"></asp:ListItem>
<asp:ListItem Text="Deactive" Value="0"></asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</ContentTemplate>
</asp:UpdatePanel>

Why my "<asp:ListView" isn't showing on the screen?

This is part of my code that isn't working. I have looked for somethings, but i cannot search what my asp:ListView isn't showing, if someone knows about it, Help me !
<asp:ListView ItemPlaceholderID="PlaceHolder1" runat="server" ID="ListViewUser">
<LayoutTemplate>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"/>
<table id="Table1" class="TableListView" runat="server">
<tr id="Tr1" class="TableHeader" runat="server">
<td id="td1" runat="server">Nível</td>
<td id="td2" runat="server">Descrição</td>
<td id="td3" runat="server">Quantidade de Problema ?</td>
<td id="td4" runat="server">Selecionar</td>
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr class="ItemsCSS">
<td>
<asp:Label runat="server"
ID="Label1"
Text="Problema" >
</asp:Label>
</td>
<td>
<asp:Label runat="server"
ID="Label2"
Text="Problema" >
</asp:Label>
</td>
<td>
<asp:Label runat="server"
ID="Label3"
Text="Problema" >
</asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
Your ListView lacks bindings. You can add a DataSourceID property to the top level control and point to a DataSource control or programmatically bind to the DataSource property and then invoke DataBind(). But the control will not display anything without first binding it.

Dynamic TabPanels with nested listviews (having dynamic items) asp.net

I have TabControl(AjaxToolKit) having 2 Nested ListViews.
code:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TabContainer ID="tcQuestions" runat="server" ActiveTabIndex="0" OnDemand="true" AutoPostBack="false" TabStripPlacement="Top" ScrollBars="None" UseVerticalStripPlacement="false">
<asp:TabPanel ID="tpFirst" runat="server" HeaderText="Page 1" Enabled="true" ScrollBars="Auto"
OnDemandMode="Once">
<ContentTemplate>
<asp:Panel ID="pnlNoData" runat="server">
<asp:LinkButton ID="lbQuestionsAdd" Text="Add Question" runat="server" />
</asp:Panel>
<asp:Panel ID="pnlListView" runat="server">
<asp:ListView ID="lsvQuestions" runat="server" ItemPlaceholderID="phItemPlaceHoler">
<EmptyDataTemplate>
<em>NO RECORD WAS FOUND</em>
</EmptyDataTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label ID="lblQuestionID" Text='<%#Eval("intQuesId") %>' Visible="false" runat="server" />
<asp:Label ID="lblQuestionTitle" Text='<%#Eval("strQuesTitle") %>' runat="server" />
<%--1.Are you doing job?--%>
</td>
</tr>
<%--Inner Listview--%>
<asp:ListView ID="lsvAnswers" runat="server" ItemPlaceholderID="phItemPlaceHolerAnswers">
<LayoutTemplate>
<table runat="server" id="table1">
<tr runat="server" id="phItemPlaceHolerAnswers">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<asp:PlaceHolder ID="plControl" runat="server" />
</td>
</tr>
</ItemTemplate>
<EmptyDataTemplate>
<em>NO RECORD WAS FOUND</em>
</EmptyDataTemplate>
</asp:ListView>
</ItemTemplate>
<LayoutTemplate>
<table class="tblAll">
<tbody>
<tr>
<td style="width: 125px">
<asp:LinkButton ID="lbtnAddQuestions" runat="server">Add Questions</asp:LinkButton>
</td>
<td style="width: 316px">
<asp:LinkButton ID="lbtnDesignTools" runat="server">Design Tools</asp:LinkButton>
</td>
<td class="formTopLinks">
<img class="imgicons" src="../Layout/images/edit.png" />
<asp:LinkButton ID="lbEditProperties" runat="server" CssClass="lnkbuttonText">Edit Properties</asp:LinkButton>
</td>
<td class="formTopLinks">
<img class="imgicons" src="../Layout/images/Delete.png" />
<asp:LinkButton ID="lbCopyPage" runat="server" CssClass="lnkbuttonText">Copy Page</asp:LinkButton>
</td>
<td class="formTopLinks">
<img class="imgicons" src="../Layout/images/Copy.png" />
<asp:LinkButton ID="lbDeletePage" runat="server" CssClass="lnkbuttonText">Delete Page</asp:LinkButton>
</td>
<td style="width: 20px;">
<img class="imgicons" src="../Layout/images/left.png" />
</td>
<td style="width: 64px;">
<asp:Label ID="Label1" runat="server" CssClass="lnkbuttonText" Text="Move Page" />
</td>
<td style="width: 20px;">
<img class="imgicons" src="../Layout/images/right.png" />
</td>
<td>
 
</td>
</tr>
</tbody>
</table>
<br />
<table class="tblAll">
<tbody>
<asp:PlaceHolder ID="phItemPlaceHoler" runat="server"></asp:PlaceHolder>
</tbody>
</table>
</LayoutTemplate>
</asp:ListView>
</asp:Panel>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
Where, I am getting Question from Table "Question", and its answers from another table "Answers". Each Question is linked with a PageNumber.
so, i have to create TabPanels according to PageNumber from Question, Then Bind Question Label with that Question, and fill 2nd ListView with Answers of that Question.
These answers are dynamic controls based on db entries e.g textbox, checkboxlists, radiobutton lists and may vary for every question.
Now what i am doing is copying tabPanel 1 to new TabPanel and adding question and answers according to db values, but when i am creating 2nd TabPanel, it give me error that
Cannot unregister UpdatePanel with ID 'ContentPlaceHolder1_tcQuestions_tpFirst_updatePanel' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
What is the best approach to handle this scenerio.
something like SurverMonkey except i am using tabs for new page.

Ajax UpdatePanel not working in IE9

I am using updatepanel to avoid the postback and the code is working fine in IE8 and firefox but not in IE9. I also tried installing latest ajax toolkit from codeplex but it did not help me either.Please help me with this. My code is something like below/....
<table width="800px">
<tr>
<asp:UpdatePanel runat="server" ID="upCountry">
<ContentTemplate>
<td class="TextLabelForHeader" width="300px">
Country:
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="ddlCountry"
ErrorMessage="*" InitialValue="Select.." ValidationGroup="VGHeader"></asp:RequiredFieldValidator>
</td>
<td align="left">
<asp:DropDownList ID="ddlCountry" runat="server" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged"
AutoPostBack="true" OnDataBound="ddlCountry_DataBound" onchange="SelectCurrency(this);"
ValidationGroup="VGHeader">
</asp:DropDownList>
</td>
<td align="left">
</td>
</ContentTemplate>
</asp:UpdatePanel>
</tr>
<tr>
<asp:UpdatePanel runat="server" ID="upCurrency">
<ContentTemplate>
<td class="TextLabelForHeader" width="300px">
Currency:
</td>
<td align="left">
<asp:DropDownList ID="ddlCurrency" runat="server" ValidationGroup="VGHeader">
</asp:DropDownList>
</td>
<td align="left">
</td>
</ContentTemplate>
</asp:UpdatePanel>
</tr>
<tr>
<td class="TextLabelForHeader" width="300px">
Client:
<%--<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="ddlClient" ErrorMessage="*" InitialValue="Select.."
ValidationGroup="VGHeader"></asp:RequiredFieldValidator>--%>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtClient"
ErrorMessage="*" ValidationGroup="VGHeader"></asp:RequiredFieldValidator>
</td>
<td align="left">
<%-- <asp:DropDownList ID="ddlClient" runat="server" Height="16px" Width="143px" Enabled="false"
OnDataBound="ddlClient_DataBound" onchange="DisplayTextbox(this);" ValidationGroup="VGHeader">
</asp:DropDownList>--%>
<asp:TextBox ID="txtClient" runat="server" Width="143px" ReadOnly="true" ValidationGroup="VGHeader"></asp:TextBox>
<%--<div id="form_ProductContainer" style="display: none;">
<asp:TextBox ID="txtNewClientName" runat="server"></asp:TextBox>
</div>--%>
</td>
<td class="TextLabelForHeader" style="text-align: left;">
<asp:Button ID="btnContinue" runat="server" OnClick="btnContinue_Click" Text="Continue"
ValidationGroup="VGHeader" />
</td>
</tr>
</table>
Discussion: Is it vital that it uses IE9 as is? If it isn't then you could just force it to render as IE8 with the following code inserted in the head section of the page or master page.
Possible Solution:
<meta http-equiv="X-UA-Compatible" content="IE=IE8" />
Updated Response
Identified Issue: I had a look at your code and you have no update Panel inside the last TR element. I imagine now that the code originally worked in IE8 because you probably had another update panel that covered the entire table.

asp.net Update Panel capturing Button clicks

I have a page that has an ASP.NET UpdatePanel on it. The UpdatePanel contains a repeater, and within the repeater is a command button. (please see the code example below)
When I click on the button the first time, nothing happens. But the second time I click on the same button, then I get the event I was expecting triggered. I am at a loss as to why this is, though I am sure there is a simple explanation. Any advice would be helpful.
<!-- Drivers Table -->
<asp:UpdatePanel runat="server" ID="DriverUpdatePanel" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:HiddenField runat="server" ID="DriverErrors" />
<asp:Repeater ID="DriverRepeater" runat="server" OnItemDataBound="DriverRepeater_ItemDataBound" OnItemCommand="DriverRepeater_ItemCommand">
<HeaderTemplate>
<table cellspacing="0" class="section-table">
<tr>
<td class="bg_mid" colspan="7"><img src="/images/sections/drivers.png" alt="Drivers" /></td>
</tr>
<tr>
<td class="text_1 left-cell">#</td>
<td class="text_1">Name</td>
<td class="text_1">Date Of Birth</td>
<td class="text_1">Gender</td>
<td class="text_1">License #</td>
<td class="text_1">Relationship</td>
<td class="text_1" align="right"> </td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr id="DriverRow" runat="server">
<td class="text_2 required left-cell"><asp:Label ID="DriverNumber" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "DriverNumber")%>'></asp:Label></td>
<td class="text_2 required"><asp:Label ID="DriverName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "FirstName")%>'></asp:Label></td>
<td class="text_2 required"><asp:Label ID="BirthDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "BirthDate")%>'></asp:Label></td>
<td class="text_2 required"><asp:Label ID="Gender" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Gender").ToString() == "F" ? "Female" : "Male" %>'></asp:Label></td>
<td class="text_2 required"><asp:Label ID="DriversLicenseNumber" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "LicenseInformation.DriversLicenseNumber")%>'></asp:Label></td>
<td class="text_2 required"><asp:Label ID="RelationshipToApplicant" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "RelationshipToApplicant")%>'></asp:Label></td>
<td class="text_2 right-cell" align="right"><asp:ImageButton runat="server" ID="DriverEditButton"
ImageUrl="/images/edit.jpg" AlternateText="Edit" CommandName="Edit" CausesValidation="false" /></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
make UpdatePanel Mode="Conditional" and enableviewstate="true"
you not need to defined trigger and you work is done without it.

Resources