Page Refresh And Bind Not Working?
Jan 3, 2010
I've got a .aspx and in it an .ascx. In the .ascx I have a server control.
The .aspx has a list of items in a cart The .ascx has a list of some cross-sell items (fed from a custom server control) that the customer can add to the cart if desired both the list of items in cart and list of cross sell items are driven by a repeater and bound on page load. So the .aspx calls a method that rebinds the cart items on page load. And the .ascx calls a method in its page load that rebinds the cross sell items in that custom control (.cs) that is in my .ascx.
The problem I have is, when the user clicks a "add to cart" button in the repeater inside my custom control, the page refreshes and what should happen is the cart items in the .aspx AND the list of cross sells should refrsh showing that the cross sell item was moved to the cart. But even though when I debug and I see the list being rebound with the corret # of items after the move, the page still shows the old state. I have to refresh the page manually again to get it to work.
I guess I need to check for Page.IsPostback? but even if I don't check that..at the least both lists should be refreshing regardless cause I have it in my page load. So even if it's a postback, and I'm not checking for that the lists should show the new state because I'm not even checking for postback anyway. So checking for postaback I don't think is the issue here cause i want the lists to rebind and re-update on any page load....initial or if it's a postback...it doesn't matter. Reload every time. But it doesn't seem to be doing this even though I clearly see the revbind of the lists having the right count (one less on the cross sell and one additional to the cart as it was added after the user clicked the button).
Here's the sequence of events:
User is on their cart page User sees a list of cart items that they have added to their cart already (this list is bound in the Cart.aspx and rebound on every page load)User sees a list of possible cross sell items they can add to their cart somewhere on the page. This list is a custom control found in my .ascx and that .ascx is obviously in my .aspx.
The custom control is just a repeater that lists out the cross sell itemsUser clicks one of the "Add to cart" buttons on one of the cross sells Page refreshes. In the page load of the .aspx AND the .ascx, I am going out to the DB and rebinding both those lists based on the new state...that is, the new lists after the item was added to the cart which means that now the cart items should have one more added to the list and it does...I clearly see that the new list has one more.
The page comes back after the refresh but I don't see the lists reflecting the new state...I don't see the new item in the cart items list and the added cross sell removed from the cross sell list even though again both lists when I debug are showing correct set of records reflecting the new state.
View 2 Replies
Similar Messages:
May 30, 2010
I am trying to refresh an asp.net page using this command:
<meta http-equiv="Refresh" content="10"/>
On that page I have 2 treeviews. The refresh works ok when I just open the page, but when I click on one of the treeviews and expand it, the refresh stopps working and the page isnt being refreshed. Is there any connection to the treeview being expanded? Here is the full code of the page:
public partial class Results : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
// Function that moves reviewed yellow card to reviewed tree
protected void ycActiveTree_SelectedNodeChanged(object sender, EventArgs e)
{
ycActiveTree.SelectedNode.Text = "Move To Active";
ycReviewedTree.PopulateNodesFromClient = false;
ycReviewedTree.Nodes[ycReviewedTree.Nodes.Count - 1].ChildNodes.Add(ycActiveTree.SelectedNode.Parent);
Application["reviewedTree"] = new ArrayList();
int count = ((ArrayList)Application["activeTree"]).Count;
// Move all the nodes from activeTree application to reviewedTree application
for (int i = 0; Application["activeTree"] != null && i < count; i++)
{
((ArrayList)Application["reviewedTree"]).Add(((ArrayList)Application["activeTree"])[i]);
((ArrayList)Application["activeTree"]).RemoveAt(0);
}
}
protected void ycActiveTree_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
if (Application["idList"] != null && e.Node.Depth == 0)
{
string[] words = ((String)Application["idList"]).Split(' '); // Yellow Card details
TreeNode child = new TreeNode("");
// Go over all the yellow card details and populate the treeview
for (int i = 1; i < words.Length; i++)
{
child.SelectAction = TreeNodeSelectAction.None;
// Same yellow card
if (words[i] != "*")
{
// End of details and start of point ip's
if (words[i] == "$")
{
// Add the yellow card node
TreeNode yellowCardNode = new TreeNode(child.Text);
yellowCardNode.SelectAction = TreeNodeSelectAction.Expand;
e.Node.ChildNodes.Add(yellowCardNode);
child.Text = "";
}
// yellow card details
else
{
child.Text = child.Text + words[i] + " ";
}
}
// End of yellow card
else
{
child.PopulateOnDemand = false;
child.SelectAction = TreeNodeSelectAction.None;
// Populate the yellow card node
e.Node.ChildNodes[e.Node.ChildNodes.Count - 1].ChildNodes.Add(child);
TreeNode moveChild = new TreeNode("Move To Reviewed");
moveChild.PopulateOnDemand = false;
moveChild.SelectAction = TreeNodeSelectAction.Select;
e.Node.ChildNodes[e.Node.ChildNodes.Count - 1].ChildNodes.Add(moveChild);
child = new TreeNode("");
Application["activeTree"] = new ArrayList();
((ArrayList)Application["activeTree"]).Add(e.Node.ChildNodes[e.Node.ChildNodes.Count - 1]);
}
}
}
// If there arent new yellow cards
else if (Application["activeTree"] != null)
{
// Populate the active tree
for (int i = 0; i < ((ArrayList)Application["activeTree"]).Count; i++)
{
e.Node.ChildNodes.Add((TreeNode)((ArrayList)Application["activeTree"])[i]);
}
}
// If there were new yellow cards and nodes that moved from reviewed tree to active tree
if (Application["idList"] != null && Application["activeTree"] != null && e.Node.ChildNodes.Count != ((ArrayList)Application["activeTree"]).Count)
{
for (int i = e.Node.ChildNodes.Count; i < ((ArrayList)Application["activeTree"]).Count; i++)
{
e.Node.ChildNodes.Add((TreeNode)((ArrayList)Application["activeTree"])[i]);
}
}
// Nullify the yellow card id's
Application["idList"] = null;
}
protected void ycReviewedTree_SelectedNodeChanged(object sender, EventArgs e)
{
ycActiveTree.PopulateNodesFromClient = false;
ycReviewedTree.SelectedNode.Text = "Move To Reviewed";
ycActiveTree.Nodes[ycActiveTree.Nodes.Count - 1].ChildNodes.Add(ycReviewedTree.SelectedNode.Parent);
int count = ((ArrayList)Application["reviewedTree"]).Count;
// Move all the nodes from reviewedTree application to activeTree application
for (int i = 0; Application["reviewedTree"] != null && i < count; i++)
{
((ArrayList)Application["activeTree"]).Add(((ArrayList)Application["reviewedTree"])[i]);
((ArrayList)Application["reviewedTree"]).RemoveAt(0);
}
}
protected void ycReviewedTree_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
if (Application["reviewedTree"] != null)
{
// Populate the reviewed tree
for (int i = 0; i < ((ArrayList)Application["reviewedTree"]).Count; i++)
{
e.Node.ChildNodes.Add((TreeNode)((ArrayList)Application["reviewedTree"])[i]);
}
}
}
}
View 1 Replies
Mar 2, 2011
I have used a radiobuttonlist to enable/disable the textbox in Grid View. I did this using javascript onclick event.
[Code]....
It is working fine when the page get refreshed too.
[Code]....
Then in a scenario, I have removed the radliobuttonlist items (items 2 and 3) dynamically. For the first time when its loaded its working without flaws. After a page is refreshing due to any serverside events, the javascript to enable/disable textbox is not working.
[Code]....
I have verified the HTML file, the radiobuttonlist is loaded without the onclick event.
View 1 Replies
Oct 28, 2012
I've a function named fillgrid() which fills the grid with data.This function works correctly on pageload,but after inserting into database i've called this function again, which is not getting executed.This issue happens only in real time server not in my local system,I'm not getting any error and i cannot recognize why fillgrid() function is not getting called??I've used update panel.This is the code for insert function which inserts over 500records.
DataTable dtMob = new DataTable();
dtMob = dtMobilizn.Copy();
DataSet dsMobilizn=new DataSet("dsMobilization");
[code]....
View 1 Replies
Nov 3, 2010
I have a table on my page. I need to scroll down a little to get to that table. In that table i have som data that i edit and save to database. When the save is done i need to refresh the page( Response.Redirect(Request.RawUrl )) so it loads the new data to that table. When the refresh is done the page is on top again so that i need to scroll down again to see the table. This makes it very unusable for the user.
How can i refresh the page without it going back to top again? I tryed wrapping an updatepanel around the table but it didnt
View 1 Replies
Mar 11, 2011
how we can refresh small part of the web page without refresh the entire page in C# ?
View 2 Replies
Jan 18, 2010
1. Is there anyway to make an ifrom refresh without having to refresh the whole page?
2. My iframe just wont display when I run it. It just displays a grey screen with the file name in the middle.
<
iframe
runat="server"
id="IframeOne"
src="~/Test.aspx"></iframe>
View 3 Replies
Feb 10, 2010
Is there a Page.Refresh type of Command to refresh a page? I don't want to redirect to the page or refresh in javascript.
View 4 Replies
Nov 14, 2010
I generate report using parameters.I pass parameter on run time & report is generated. For Example: At first i am displaying A list of customers having SEX = MALE. Than I enter SEX = FEMALE. But it still displaying the MALE list Results. If i rebuild my webform and than put parameter FEMALE then it displays. So, If i generate a report once. I dont want to rebuild my webform to pass new parameter. . How it should be Done. I added one line code CrystalreportViewer1.RefreshReport(); but it did not work for me. I am using VS 2010..
View 1 Replies
Dec 3, 2010
I am working on a small application and am using the regular web app template (w/ master page) that comes with webdev express 10. There are four pages on the site, and each of them seems to be working like I would expect. The problem is that the asp:menu that is being used for navigation (part of the template) causes the entire page to redraw every time I use it and it pretty much looks like ass. What can I do to prevent this? I have already tried putting those elements in an update panel, but that isn't working for me. I'm not getting any errors, but it could be a syntax thing.
View 8 Replies
Aug 27, 2010
i am using ajaxtoolkit:combobox and i tried to bind data to this control in code behind file.but it is taking 3 to 4 mints to bind data and display the page. I am providing my aspx code and code behind code here
[Code]....
Code behind code:
[Code]....
GetPrograms() method will return almost 6000 records. to load the control it is taking almost 4 minuts..
View 4 Replies
Jan 22, 2011
I'm having a problem with a FormView control that I have bound to an ObjectDataSource. The problem is that the FormView control is not automatically filled in with the public properties of the object linked by an ObjectDataSource control when I select refresh schema. Everything compiles and I can add fields manually, but there are a lot of properties in the class and I do not want to deal with adding all the fields by hand. It's not the end of the world of course if I have to add them manually, but I'm bothered more by the fact that it doesn't act the other formviews.
Has anyone ever experienced a problem like this? I have other objectdatasource controls with other formviews that properly refresh their schemas. I noticed that in the objectdatasource control that is giving me problems, the DataObjectTypeName field is not automatically set as it is in the others. However, after adding it manually it still doesn't refresh the schema. I'm using Visual Studio 2010. Defined in .aspx page:
[Code]....
The SPFModuleBLL class contains the GetModule2() method which is shown here:
[Code]....
View 3 Replies
Dec 20, 2010
We are using Web Part Zones to display certain Charts in our website. In the title of the Zone, we are using the below code to display the menu for Minimize, Refresh and Close buttons.
<CloseVerb ImageUrl="~/Images/Close.png" />
<MenuVerbStyle BorderColor="#5D7B9D" BorderStyle="Solid" BorderWidth="1px" ForeColor="White" />
<TitleBarVerbStyle CssClass="WPVerbBar" />[code]....
This buttons are working fine in IE and in Firefox. But the same is not working in Chorme and in Safari.We got the below script error in Chrome:
Uncaught TypeError: Object #<an HTMLElement> has no method 'attachEvent'
ScriptResource.axd?d=JgYxHqt6li1Lc12at8VRK-y-qeXK_5Wiei-tKNUi8rRE-1X5EEl-KvYEuW4m8Foj1VyIiaN7sK98_-pMwa5y7w2&t=633802855995006876:277Uncaught TypeError: Object #<an HTMLElement> has no method 'attachEvent'
View 1 Replies
Mar 14, 2010
Isn't the Bind attribute, preferable the Exclude parameter, define any properties that will be excluded from any form update? If so, why does the ModelState is not valid when I do this?
[code]...
View 1 Replies
Jun 25, 2010
protected void ddOne_SelectedIndexChanged(object sender, EventArgs e) { PopulateType(); } private void PopulateType() { DataSet dstype = new DataSet(); //Assign DataSet by stored procedure that is working correctly and //DataSet has values that I want to ddType.DataSource = dstype; ddType.DataTextField = "Name"; ddType.DataValueField = "ID"; //I have watching values in visual studio.net and its working perfect //using QuickWatch and breakpoints ddType.DataBind(); }I have to give data source and bind a dropdownList with the event of another dropdownlist ....At code it is working good but At webpage, It is not showing the DropDownList.
View 3 Replies
Feb 18, 2010
How can I use double buffering in asp.net C#?I want smthng like that : I dont want full page refresh when I click a button in a web page.. I think it can be solved with double buffering. When a button clicked for redirect a content page (button-in master page), current page will not go until the redirected page completely load in the background..
View 3 Replies
Feb 26, 2011
I have Update panel in Master page:
<asp:ScriptManager id="CartScript" runat="server"></asp:ScriptManager>
<asp:UpdatePanel id="CartBox" runat="server" updateMode="Conditional">
<ContentTemplate> [code]...
But i got same error. how I can add to my Update Panel that Button from Content Page can refresh it?
View 1 Replies
Nov 15, 2010
how can go to next page in gridview without refresh page
i thing programmers says wihtout postback?
View 1 Replies
Sep 30, 2010
I have a page that is opened in a popup window from the main page. Once i click insert it pops up a message that says you have successfully added blah blah. Then once you click ok it closes the popup page and goes back to the main page. I want to be able to refresh the main page back to how it was when you first land on the page. Here is the code for my insert button:
[Code]....
View 26 Replies
Mar 5, 2011
I have master page
MyMasterPage.aspx and content page MyDefault.aspx.
MyMasterPage.aspx has one input button [value="Menu-1"]. When user click the button, the button will pass value "Menu-1" into
TextBox1Default1 at content page MyDefault.aspx, and then refresh
UpdatePanelDefault1 at content page MyDefault.aspx asynchronously.
My problem is the post back is full post back when refreshing UpdatePanelDefault1. I would like asynchronously post back during refreshing UpdatePanelDefault1. copy the full code MyMasterPage.aspx and MyDefault.aspx below, and then paste / overwrite it into your blank aspx page for testing. I am using VS 2008
Below is full code MyMasterPage.aspx.[Code]....
View 9 Replies
Jul 20, 2012
I am writing a web application which consists of a master page (header / menus) which does not change and content pages. When I do something like click on a button it causes a post back which is correct but this redraws the whole screen and becomes annoying because every post back and the whole screen flickers.
Is there a way to only refresh the content page?
View 5 Replies
Nov 21, 2010
how to open a new page in Jquery on Click of anchor tag ...
I guess this functionality is not achiveable with Jquery That is Why i use GreyBox for this .
In [URL]
But the Problem is when we click on see detail button of each product , It will open a page in IFRAME ..
When we click Add to Cart Button , it will open the new page in that I-FRAME
I want to refresh the parent page to be Refreshed ... it will open the Shopping cart page in the IFRAME
Is There any other way to achive this functionality , any other jquery ??
View 1 Replies
Nov 9, 2010
I have 40 record in database. But I am displaying 10 record in each page in store grid. But the problem is when I refresh the page or grid, it shows first record in first page. how can I get current page data when refreshing data? How can I avoid this
View 3 Replies
Aug 26, 2012
I have the following Repeater, I need to bind multiple querystring parameter inĀ HREF
<li class="current">
<a href="house.aspx?H_name=all"></a>
<ul>
<asp:Repeater ID="rptMenu" runat="server">
<ItemTemplate>
[code]...
View 1 Replies
Jun 22, 2010
I have a page that add Items to RadioButtonList with this code :
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
RD.Read()
RBQ1.Items.Add(RD.GetString(3))
RBQ1.Items.Add(RD.GetString(4))
RBQ1.Items.Add(RD.GetString(5))
View 2 Replies