Multiple Update Panels In a Datalist. Can't Add Trigger - asp.net

My issues here is that this does not compile. I get "A control with ID 'LinkButtonRemove' could not be found for the trigger in UpdatePanel 'UpdatePanelFiles'."
What I am trying to do is have two buttons in the item template. One that updates just the ITEM and one that updates the entire DataList. "LinkButtonRemove" is what I want to update the entire datalist. Any ideas on why this isnt working? Or how to do what I want to do?
THE SHORT VERSION:
UPDATEPANEL1
-DATALIST
--ITEM
---UPDATEPANEL2
----CONTROLS
I want one control to update the item updatepanel only and the other to update the entire datalist.
<asp:UpdatePanel ID="UpdatePanelFiles" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LinkButtonRemove" />
</Triggers>
<ContentTemplate>
<asp:DataList ID="DataListFiles" class="MediaManagerDataList" runat="server" ItemStyle-BackColor="#ffffff" AlternatingItemStyle-BackColor="#E7F4FF" OnItemCommand="DataListFiles_ItemCommand">
<ItemTemplate>
<asp:UpdatePanel ID="UpdatePanelItem" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="item">
<asp:LinkButton ID="LinkButtonRemove" CommandName="remove" runat="server">Remove</asp:LinkButton>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:DataList>
</ContentTemplate>
</asp:UpdatePanel>

The updatepanel can't see the button, but it can see the list. You can skip the trigger part and just call updatepanel.update() in your codebehind when you handle the click event.

You can do this by putting the DataList's Id instead of the linkbutton

Related

RowIndex attribute of templated field inside update panel

I want my templated buttons to have an update panel around it, but it messes up my rowindex attribute for the control. I tried to get the parent of the container but it says displayindex is not a property
<ItemTemplate>
<asp:UpdatePanel runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="IBRemove" EventName="click" />
</Triggers>
<ContentTemplate>
<asp:ImageButton ID="IBRemove" runat="server" RowIndex="<%# Contanier.Parent.Displayindex %>" OnClick="IBRemove_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
The Link that VDWWD commented worked fine and it makes more sense to wrap the entire gridview in the update panel.
I was looking for this though:
RowIndex="<%# (DirectCast(Container, IDataItemContainer)).DisplayIndex %>"

Asp.net Data list paging without page refresh

I want to apply paging using datalist with out page refresh in asp.net
My Code Structure is below.
<asp:UpdateProgress ID="updProgress" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
<ProgressTemplate>
<div id="something">
<img alt="progress" src="loader.gif" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
Paging Items
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="dlPagingg" EventName="ItemCommand" />
</Triggers>
</asp:UpdatePanel>
<asp:DataList ID="DataListProducts" runat="server" OnItemDataBound="DataListProducts_ItemDataBound">
<ItemStyle CssClass="listing-pro-img-main" VerticalAlign="Top" />
<ItemTemplate>
Product List Here
</ItemTemplate>
</asp:DataList>
Issue: When user click on page number in paging list, paging change with appropriate page number , but products in datalist product not refresh.
i have also debug that all code file getting product and assign to datasource property of DataListProducts like,
DataListProducts.DataSource = {New Product List}
DataListProducts.DataBind();
Can you please advise me where issue is?
You can use Jquery DataTable
To wrap your table on the client side and then get the option to page, sort and filter you columns.
No refresh, no postback and no url changes.

Update Panel is not working over there "OnSelectedIndexChanged" Event which is inside a repeater

I have put an update panel in a page and its working properly.In that page i was
loading an repeater and its also working properly.But inside that repeater i am firing an event "OnSelectedIndexChanged" in a dropdownList .while using it the page is getting refreshed. seems update panel is not working over there.
<asp:UpdatePanel ID="update_invest" runat="server" UpdateMode="Always">
<ContentTemplate>
<asp:Repeater ID="rptinvest" runat="server" OnItemDataBound="rptactions_ItemDataBound">
<ItemTemplate>
<td>
<asp:DropDownList ID="ddlemployee" runat="server" OnSelectedIndexChanged="ddlEmployee_SelectedIndexChanged"
AppendDataBoundItems="true" AutoPostBack="True">
</asp:DropDownList>
</td>
</ItemTemplate>
</asp:Repeater>
the above is the code....!!
Thanks Arshad..!
I think you need to register the postback triggering controls inside update panel. In your code snippet, it is ddlemployee. If it was in the mark up, you can do so like:
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlemployee" EventName="OnSelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
However, drop down control is nested inside repeater that you have to register it from code behind like:
For Each item As RepeaterItem In rptinvest.Items
Dim ddlemployee As DropDownList = DirectCast(item.FindControl("ddlemployee"), DropDownList)
ScriptManager1.RegisterAsyncPostBackControl(ddlemployee)
Next
Hope this help you. Visit here for more information about update panel and triggers.

ASP.NET GridView is not updating inside an UpdatePanel

I have a GridView that is bound to a SQL Data source. I have put this inside an Update panel and want the contents to update at a specified interval. The problem is that if i change the data in the database, the GridView does not update itself, i have to manually refresh the page to view the new data.
What else do I need to do to get a GridView to refresh itself?
<asp:Timer ID="RefreshTimer" runat="server" Interval="10000"
ontick="RefreshTimer_Tick">
</asp:Timer>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="quad1"><uc1:MyWidget ID="MyWidget1" runat="server" /></div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="RefreshTimer" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
You have to call gridView.DataBind() on tick event
Use a Timer like this:
<asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="30000">
Follow this Auto-refresh update panel sample and should have no problem. Let me know if you do.

How to enable a dropdownlist in an update panel to make a full post back

Q:
I have the following case :
Two drop down lists :
The first one for the camp.
The second one for the faculty .
When the user selects from the camp .I fill the faculty ddl according to his selection.
I put my second ddl in an updatepanel so ,this part of the page only posted back.
but i wanna when i select an item from the second ddl(the faculty one), force full post back to the whole page to view an report .
How to do this .
My aspx:
<asp:DropDownList ID="ddl_camp_s" runat="server" Width="200px" AutoPostBack="True"
OnSelectedIndexChanged="ddl_camp_s_SelectedIndexChanged">
</asp:DropDownList>
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddl_fac_s" runat="server" Width="400px" AutoPostBack="True"
OnSelectedIndexChanged="ddl_fac_s_SelectedIndexChanged">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddl_camp_s"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
It would be better using cascadingdropdown from ajax control toolkit
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx
Try add this in your update panel triggers
<Triggers>
<asp:PostBackTrigger ControlID="ControlIdToForceFullPOstBack" />
</Triggers>
Hope this help

Resources