VS 2010 - Keeping Results After Postback?

Jul 1, 2012

I am having problems getting my head around this, so my terminalogy might be off. What I am trying to do is have a dropdown list with different groups, and then two listboxes that run queries based on the selection from the dropdownbox. The left listbox shows all items except those which are in the selected group. The right listbox shows only those in the selected group. I also have two buttons - one to move selected items from the left listbox to the right listbox, and another to move items from the right to the left.

My page has a dropdown list for Groups, populated with 2 records - Group A & Group B. Autopostback is set. When I change my selection on the dropdown list, my two listboxes do change

The problem comes in when I select items in the listbox and click on the transfer button. The records do transfer correctly (that is to say the database query executed correctly and data is moved), but the List boxes are not updated. What I want is to have the form refresh, but there is no AutoPostback for the Button object.

I tried inserting a Response.Redirect back to the same page at the end of the button click event. I thought this would allow me to process the sql command, and then refresh the data. This almost works. It does refresh the listboxes, but it also resets the dropdownbox to the first entry. This in turn changes what is displayed in the listboxes. The data is moved correctly though.

So at this point I have my choice. If the dropdown box behaves and does not change, then the listboxes don't update. If the listboxes do update, the dropdown box resets to the default value.

View 5 Replies


Similar Messages:

Web Forms :: DropDownList Not Keeping Last Value On PostBack?

Apr 6, 2010

This would be a simple one for me if I was binding this dynamically. I don't think it's necessary to have a code behind for only 4 or so values. Anyways here is my ddl.

[Code]....

The problem is that when a user selects a value and it postbacks my ddl resets to the first value. How do I prevent this?

View 8 Replies

AJAX :: Keeping Selectedvalue Of CascadingDropDown After Postback?

Jul 30, 2010

I have a cascadingdropdown which works fine using a webservice and is populated. I can save the value of this dropdown to the database buy clicking a save button. However when the page reloads, the list is populated again. Is there a way to keep/set the selectedvalue after postback?

View 7 Replies

VS 2010 Keeping Selected Treenode Selected?

Mar 9, 2011

I´m using a treenode´s selected node´s value to filter a an accessdatasource which populates a gridview.However when I press the "edit" button in the gridview, I guess the node is undselected because the gridview gets emptied. When I reselect the node, the gridview displays the filtered records, and the one being edited is in edited mode.So I´d like to keep the node selected. Not only because of the above, but also so the user can see what he is editing.Fuga.edit: When I remove the filtering from the accessdatasource init event, the gridview diplays all records, but the worng one is being edited. I guess it´s the one with the same index as the filtered record. So, visual studio gets the index and then reloads the data and applies the index on the reloaded data!?

View 6 Replies

C# - Timer Results In Updatepanel Gives Full Postback

Jan 19, 2011

I have a quite strange situation where I have the following code:

<asp:Timer ID="GameClock" runat="server" Interval="5000" Enabled="true"
ontick="GameClock_Tick">
</asp:Timer>
<asp:UpdatePanel ID="ItemsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<Triggers>

NOTE THE TRIGGER IS COMMENTED OUT

<%--<asp:AsyncPostBackTrigger ControlID="GameClock" EventName="Tick" />--%>
</Triggers>
<ContentTemplate>
<asp:ListView ID="PlayerItems" runat="server" GroupItemCount="7"
onitemdatabound="PlayerItems_ItemDataBound">
<LayoutTemplate>
<table border="1" cellpadding="2" cellspacing="0" runat="server" id="tblProducts">
<tr runat="server" id="groupPlaceholder">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<td id="Td1" runat="server" style="vertical-align:top; text-align:left; height:100%;">
<div>
<div id="category" runat="server">
<asp:Panel ID="ItemPanel" runat="server">
</asp:Panel>
</div>
</div>
</td>
</ItemTemplate>
<GroupTemplate>
<tr runat="server" id="productRow">
<td runat="server" id="itemPlaceholder"></td>
</tr>
</GroupTemplate>
</asp:ListView>
</ContentTemplate>
</asp:UpdatePanel>

This gives a quite strange result: Every 5s my whole page gives a full postback. When I comment in (activate) the asyncpostbacktrigger, the updatepanel does not give a full postback. In the PlayerItems_ItemDataBound I have the following code (which, I do think, do not matter):

protected void PlayerItems_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
ListViewDataItem dataItem = e.Item as ListViewDataItem;
if (dataItem != null)
{
BaseItem myItem = dataItem.DataItem as BaseItem;
Panel itemPanel = new Panel();
Literal firstLiteral = new Literal();
firstLiteral.Text += "<div id='smoothmenu1' class='ddsmoothmenu'>";
firstLiteral.Text += "<ul>";
firstLiteral.Text += "<li><img src='Images/Game/Items/" + myItem.ItemImageUrl + "' />";
firstLiteral.Text += "<ul>";
// Add all events bound to item into contextmenu
itemPanel.Controls.Add(firstLiteral);
foreach (Delegate del in myItem.Actions.Items)
{
Literal firstItLit = new Literal();
firstItLit.Text += "<li>";
itemPanel.Controls.Add(firstItLit);
MethodInfo methodInfo = del.Method;
string commandName = myItem.ItemId + "|" + methodInfo.Name;
LinkButton btn = new LinkButton();
btn.Text = methodInfo.Name;
btn.Click += new EventHandler(btn_Click);
btn.CommandName = commandName;
itemPanel.Controls.Add(btn);
Literal secondItLit = new Literal();
secondItLit.Text += "</li>";
itemPanel.Controls.Add(secondItLit);
}
Literal btnLiteral = new Literal();
btnLiteral.Text += "</ul>";
btnLiteral.Text += "</li>";
btnLiteral.Text += "</ul>";
btnLiteral.Text += "</div>";
itemPanel.Controls.Add(btnLiteral);
Panel panel = (Panel)(e.Item.FindControl("ItemPanel"));
panel.Controls.Add(itemPanel);
}
}
}

When I create a NEW updatepanel, ItemsUpdatePanel1, it does not fire a full postback without the timer. I can even start copying items from ItemsUpdatePanel to ItemsUpdatePanel1, and suddenly the full postbacks happen. I tried 2 seperate times, and they started happening at different times.

View 2 Replies

VS 2010 - Can't Get Linq Query To Return Expected Results

Feb 13, 2014

I have a array list and am using like a database trying to search for ChildID and ParentID based on certain criteria.

My example below has the following keywords to search for:

Yellow, Mustard, Honey, Orange, Flame, Talisman

I also have a category volume value which I grab the first 2 characters to determine another filter.

My code isn't returning all matches with using 'Contains'. Right now it finds the 'Orange, Flame, Talisman'/AV record and returns 50, 28. My keywords also has 'Yellow, Mustard, Honey'/AV which should return 55 and 28 as well.

HTML Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="temp2.aspx.vb" Inherits="temp2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

[Code] ....

View 4 Replies

VS 2010 - Find Control And Casting Results In NullReferenceException

Apr 16, 2012

I'm using a third party control called an Accordion from Juice UI. Within that control, I have a table with labels.

VB.NET Code:
<juice:Accordion ID="accSwrlHddRepl" runat="server"> 
<juice:AccordionPanel runat="server" Title="HDD Information"> 
<PanelContent> <p> <table style="width: 99%;">
<tr> <td class="style2">
<asp:Label ID="Label2111111" runat="server" Text="Original HDD:"></asp:Label>   

[Code] ....

I can't access the label directly, so I'm trying to use the FindControl method to get it and set it's text property.

VB.NET Code:

CType(Me.accSwrlHddRepl.FindControl("lblFirstHddReplacement"), System.Web.UI.WebControls.Label).Text = "string"

But I get a NullReferenceException. So I moved the label outside of the table and put it just inside the accordion. The same behavior occurs. Then I gave the accordion panel an ID and did FindControl there, but the same issue occurs.

View 9 Replies

AJAX :: Timer Results In Updatepanel Gives Full Postback

Jan 19, 2011

I have a quite strange situation where I have the following code:

[Code]....

This gives a quite strange result: Every 5s my whole page gives a full postback. When I comment in (activate) the asyncpostbacktrigger, the updatepanel does not give a full postback. In the PlayerItems_ItemDataBound I have the following code (which, I do think, do not matter):

[Code]....

When I create a NEW updatepanel, ItemsUpdatePanel1, it does not fire a full postback without the timer. I can even start copying items from ItemsUpdatePanel to ItemsUpdatePanel1, and suddenly the full postbacks happen. I tried 2 seperate times, and they started happening at different times. I simply want the UpdatePanel NOT to give a full postback, even without a timer.

View 2 Replies

Visual Studio 2010 - Can View Lists During Debug Results In Timeout

Oct 26, 2010

I am trying to debug a project, suddenly I'm running into an issue where enumerating any object collections results in a timeout if I try to view it.If I run the program normally I have no issues. If I try to view any collection, such as a list, I get a timeout error and the whole thing bombs out.I thought something might be going on with one of my more complex collections so I tried creating just a normal list of strings as follows...

List<string> blah = new List<string>{"fsdf","fsdg","Gt","gsersg","ser","gersgxdrsd"};

View 1 Replies

VS 2010 FileUpload Empty During Partial Postback?

Nov 17, 2010

I have a FileUpload control inside of an update panel that I would like to use to do async file uploads. The issue I am having is that during the partial post back, the FileUpload control is empty. I was under the impression that through an update panel doing the full page life cycle that it would pick up the use input.Am I incorrect here? Can this somehow be done or do I need to do the traditional full page post back to get this to work?

View 3 Replies

VS 2010 Dynamic UserControl - Postback Event Not Firing

Feb 8, 2012

I have a page where I add a dynamic user control in the Page_Load event based on criteria.

The control is a simple form with a save button. The problem is the _Click event never fires for the button. It will postback the main page the control is within, but not the code behind for the control...so I never get the button click even, and therefor can't execute the save code.

Tried it in the init, tried adding the control to a placeholder, tried a lot of various things but nothing seems to work.

Code:
If cb_business_profile.Items.Count = 0 Then
Dim u_pnl_content As UpdatePanel = Page.FindControl("u_pnl_content")
u_pnl_content.ContentTemplateContainer.Controls.Clear()

Dim business_profile_detail As Control = LoadControl("~/controls/business_profile_detail.ascx")

[Code] ....

View 3 Replies

VS 2010 - How To Determine Why Site Takes 5 Minutes Partial Postback

Dec 19, 2013

I have a web application which has rather a lot of controls. I also have several buttons (add, edit, save, cancel). Most of my content page is in an update panel so it does not process the whole page. On form submit I have some javascript code which shows a div 50% opacity and an animated gif to prevent users clicking on the buttons more than once whilst it is processing the data to the server. Here is the javascript / call:

Code:
onsubmit="overlay();"
function overlay() {
el = document.getElementById('overlay');
el.style.display = "inline";
document.getElementById('Image2').src = "../Images/loader.gif";
}
function removeoverlay() {
el = document.getElementById('overlay');
el.style.display = "none";
}

The problem is it the form disables like I want it and the giff animates for about 1.5 seconds but it does not enable the form for a further 4 seconds.

Is there anyway to see what it happpening at this point. If I put some watches in my code behind it runs through less than a second so what else can it be doing.

Also on some laptops the form does not fit vertically so there is a scroll bar. When the div is shown on a submit it does not do the full screen including the scroll area.

View 10 Replies

VS 2010 - GridView With CheckBox In Each Row - Button To Select / Deselect All And Not Postback

Aug 12, 2011

I have a gridview with a checkbox in each row for selecting. I want to have a button which will select all/deselect all and not post back.

I first implemented this with a link and it works perfectly, but I don't like how it looks.

Code:
<a href="#" onclick="javascript:sel();">Select/deselect all</a>

Code:
<script type="text/javascript">
isSelected = false;
function sel() {
var frm = document.forms[0];
isSelected = !isSelected;

[Code] ....

So now I have a button that I want to rig up to execute this javascript. Which I believe would be done this way:

Code:
<asp:Button ID="btnSelectAllSummary" runat="server" Text="Select All" OnClientClick="javascript:sel()" />

But it is posting back. How do I prevent the postback and have it execute on the client?

View 5 Replies

Visual Studio :: Duplicate Results In "find Results 1" Window?

Jan 26, 2011

In VS2010, when I "find in files", I often get doubled results in my find window.

View 5 Replies

AJAX :: Using A Div Tag For That Keeping An Scroll Bar?

Feb 7, 2010

i am using an div tag for that i am keeping an scroll bar. which is an slider control. now here i need to replace the vertical line image with my own image . and the scroll image to. so it possiable to achive this in the slider control what we are using

View 1 Replies

Is Using An EntityDataSource In Keeping With The MVC Pattern

Apr 23, 2010

I'm utterly new to APS.NET and in particular the MVC model...! I have a Telerik RadGrid control that I'm using. Until now (following NerdDinner) I was having the Model passed back to the view and this provided access to the various properties I wanted.

eg: Inherits="System.Web.Mvc.ViewPage<MySqlMvc.Helpers.PaginatedList<MySqlMvc.Models.Customer>>

.. lets me loop around the Model object and extract Customer data. This RadGrid control, however, needs me to use an EntityDataSource (hooked up via the designer). Does this have implications for maintaing the MVC pattern? I'm a little confused about how the EntityDataSource works in relation to my Model.EDIT: I do know there is an MVC version of the RadGrid but we also need the RadScheduler and a few others.. besides that, I'd still like to know the impact.

View 1 Replies

C# - Keeping Basket More Permanent?

Feb 22, 2011

I need to keep my basket more permanent I have two options and I want to choose the best one.

I have eCommerce web site application in asp.net and there is a basket include products which are selected by users before, so options:

1- keep basket in database (consider the cost and time to store and retrieve information)
2- store my basket in Cookies (I don't know what the implementation is)

I couldn't use session because it is not permanent and clear by closing browser.

My goal is : when the user close the IE for 1 day or 2 days make ability to remember all products that already added to basket.

In addition, my basket is store in hash-table now, for example : {1:4055,2:4588,...} they are ID and product code(keys). they are all save in a hash table.

View 1 Replies

Keeping Connection Or Reconnecting To Sql?

Feb 16, 2010

I am trying to make a program that queries the same tables every few seconds.Is it better to use the same connection to reconnect everytime before the program requeries ?

View 5 Replies

ASP MVC: Keeping Track Of Logged In Users?

Apr 22, 2010

I'm creating a ASP MVC application. And because of the complex authorization i'm trying to build my own login system. (So i'm not using asp membership providers, and related classes).Now i'm able to create new accounts in the database with hashed passwords.But how do i keep track that a user is logged in.Is generating a long random number and putting this with the userID in the database and cookie enough?

View 1 Replies

Access :: Keeping Links Intact From DB?

Nov 18, 2010

I have an access DB created in 2007 and saved in 2003 (.mdb). The tables contain links to a file server on my internal network. I'm trying to import the db into Expression Web 4 and keep the links intact. Currently, I can get the import to work, but the links get stripped out and displayed as plain text.

View 5 Replies

Configuration :: Keeping Different Sites Synchronized?

Oct 1, 2010

I am currently working on multiple group sites for the same parent company. All the sites are basically the same, and share the same code base however they have different stylesheets, master pages and config files.

As the number of sites is increasing I am finding it difficult to keep the sites synchronised and propagate bug fixes/changes across them all as each has it's own copy of the code.

Does anyone know of a way I could keep a single master copy of the site and easily propogate changes to each of the other sites.

View 6 Replies

C# - Keeping Alive PostedFile.InputStream ?

Jan 21, 2010

I was wondering wich's the best way to "keep alive" the InputStream of the FileUpload Control.I would give you one example. Let's assume you have the FileUpload control in one WebForm, and you want process it in the next WebForm (after Response.Redirect).It would be great (unless for the memory) to have something similar to:

Session["PostedFile"] = this.FileUpload.PostedFile.InputStream.
Unfortunately, this results in:
System.ObjectDisposedException

View 2 Replies

Keeping The State Of The Treeview Node?

Feb 4, 2010

I have a list of treeview nodes. When I click on a node it redirect me to a page but my treeview nodes go back to my orginal settings for the nodes meaning doesn't keep the node you click on expand when directing to another page. Is there away to keep the states of the collepse nodes?

View 3 Replies

MVC :: Generating A Request ID And Keeping Track Of It?

Dec 14, 2010

I am trying to Generating a Request ID and keeping track of it from request to request.I just want to get the previous request number and bump it up by 1 and log it so I can keep track of the number of requests come to my page.I was looking into TempDataDictionary but that is not working for me.I am new to ASP.NET MVC soexcuse my ignorance.

View 1 Replies

DataSource Controls :: Update Column With New Old Value By Keeping The Old Value As Well?

Jan 25, 2010

Example:-

column values:- Microsoft Java

I like to update above record using below SQL, so that new values are appended to old values instead of removing old values.

[Code]....

Output:- Microsoft Java some text

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved