Checkboxlist Not Retaining Selection After Postback In IE?
Aug 1, 2010
Platform: ASP.Net 2.0 I have multiple checkboxlist controls on a webpage. Along with that i have the same number of buttons on that page. Initially all the checkboxlist controls are hidden. When user clicks on a button, corresponding checkboxlist controls gets visible making others hidden and allows user to select the options.
On postback, if user clicks on the same button again, the corresponding checkboxlist gets visible but the item selection is not retained. However, this happens only in IE. This works fine in FireFox. I am using JQuery to toggle the visibility of checkboxlist.I guess the problem is because i am toggling the visibility of checkboxlist which IE doesnt seem to like. What is the solution to this problem?
View 1 Replies
Similar Messages:
May 7, 2015
I need to charge my checkboxlist1 from database, eg load fruits and vegetables. When selecting fruits, new filter based on the previous selection in my checkboxlist2. for specific search.
View 1 Replies
Feb 2, 2010
I have a name textbox, label, usercontrol, submit button in my page inside a master page. when the button is clicked iam using the label to show the user "Please enter name". But any postback happens inside the user control then this lable gets cleared, how to retain the value on the postback of the user control.
View 2 Replies
Nov 25, 2010
I created checkbox in a gridview. I hope to retain the checkbox value after postback.
[Code]....
View 2 Replies
Jul 29, 2010
I'm using the asp.net PreviousPage functionality and cross-page postback. The problem i'm running into is that if I have any postbacks on my page, the PreviousPage information seems to be lost. I don't want to put it in ViewState because that will be quite large. I've thought about Session, but I don't want the data to persist after i've moved on to another page, and I really don't like the idea of putting code in all my other pages to delete old session variables.
View 1 Replies
Nov 15, 2010
I have a ASP DropDownList that gets populated on the Page_Load event, after i select an item and hit a button the selected item gets cleared and the first item in the DropDownList gets selected. (The DropDownList is only populated when the page is not postback)
if (!IsPostBack)
{
List<Country> lCountries = new List<Country>();
List<CompanySchedule> lCompanySchedules = new List<CompanySchedule>();
this.Load_Countries(lCountries);
[code]...
View 1 Replies
Feb 24, 2011
I have a project in VB.NET which is working fine which essentially has a Datagrid that has a TemplateColumn included which is a column of Checkboxes. The code to declare the datagrid is here...
<asp:datagrid id="dgDates" OnItemCommand="gridEventHandler" BorderColor="Black" BorderWidth="1px"
CellPadding="3" runat="server" AutoGenerateColumns="False" HorizontalAlign="Left" AllowSorting="True"
OnSortCommand="SortData" OnItemDataBound="gridItemDataBound">
<HeaderStyle Font-Underline="True" Font-Bold="True" HorizontalAlign="Center" ForeColor="Black"
BackColor="#D4D0C8"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="strParameterName" SortExpression="strParameterName" HeaderText="Parameter Name"></asp:BoundColumn>
<asp:BoundColumn DataField="dtParameterValue" SortExpression="dtParameterValue" HeaderText="Parameter Value"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Constant" SortExpression="blnStatic" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:CheckBox ID="cbStaticRolling" Checked="False" Runat="server" AutoPostBack="true"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
as you can see the Checkbox has Autopostback="true" but there are other things on the page which produce postbacks as well.
My Page_load has this in it, being called on every load of the page, postbacks included...
Dim strGUID As String
strGUID = Session("strGUID")
dgDates.DataSource = SqlHelper.ExecuteDataset(ConfigurationManager.AppSettings(Web. [Global].CfgKeyConnStringADMIN), "dbo.spRptGetSchedulingDates", strGUID)
dgDates.DataBind()
intNumberOfDates = dgDates.Items().Count
as well my code behind has the following code for the gridItemDataBound
Protected Sub gridItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
'hide the intRptSchedulingDatesID for each row in the checkbox's content style variable
If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then
CType(e.Item.FindControl("cbStaticRolling"), CheckBox).Style("Content") = CType(e.Item.DataItem, System.Data.DataRowView).Item("intRptSchedulingDatesID")
End If
End Sub
everything you see sbove is working perfectly fine...in the sense that when I click one of the checkboxes, the page_load fires, the gridItemDataBound fires on DataBind() and when all is done, the checkbox retains the value that the user clicked the checkbox.
With all this exact same code converted to C#....the events all fire in the same order, but the checkbox selected value always clears...any thoughts??
View 2 Replies
Jan 19, 2010
i have a <input id="FILE_UPLOAD".....................> file upload html control in my asp.net web applicationwhen a post back occurs the data entered in the control gets lost . how do i retain the data entered
View 24 Replies
Jan 13, 2011
I have a couple of RadioButtons that are created dynamically. But after postback they don't retain their checked property. I also have some CheckBoxes and they work just fine using the same mechanism (code below). I have narrowed down the problem to the "GroupName" property. If I remove it, it works just fine. But I need the RadioButtons to be mutually exclusive.
[Code]....
View 3 Replies
Apr 19, 2010
I am binding a checkboxlist with a dataset (with these columns :
id,empname,resourceId,balanceId as columns) with datavaluefield as id and datatextfield as empname;
Now, i want to control the selection of the items. Say some thing like
1. "User should be allowed to check only say 5 items with same resourceId" using javascript
2. And in total he should select only 20 items (max 5 items for same resource id and max 15 items for the remaining)
How can we control this?
View 2 Replies
Apr 27, 2010
i need to know how i can save more than 1 of the selected values from a checkboxlist to a database. I tried the following code.
ArrayList test = new ArrayList();
for (int i = 0; i < CheckBoxListMeest.Items.Count; i++)
{
[code]...
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_MeestenEvaluatie_MeestGeAsp". The conflict occurred in database "GIPDatabase", table "dbo.MeestGeAsp", column 'EvMeestID'. The statement has been terminated.
View 3 Replies
Mar 11, 2010
I was wondering how about may I save the selection of the checked items of a dynamically created CheckBoxList?On postback the entire checkboxlist is lost. As the CheckboxList items are manually added in and not databinded, the selection is also lost.I was thinking of javascript, but i'm not sure how to implement it.
View 3 Replies
Jan 3, 2011
I have a custom control with four checkboxlist(Country, City, Outlet, Stores) controls in it. The functionality is.. if a country is selected cities would be populated similarly outlet depends on city and stores depends on outlet. I am using the same functionality through out but in one webpage I need to disable the multi selection property of the country checkboxlist without disturbing others.Following is the javascript for the checkboxlist controls:
<script language="javascript" type="text/javascript">
function CheckBoxListSelect(cbControl, cbxControl)
{
[code]...
View 3 Replies
Feb 11, 2011
I have a checkboxlist control showing Q1,Q2,Q3,and Q4 and with AppendDataBoundItems="True" I added:-
<asp:ListItem Value="*">ALL</asp:ListItem>
I want when people select All, the checkboxes for Q1, Q2, Q3, and Q4 are cleared and the "All" box remain checked. How to do it ?
View 1 Replies
Jan 24, 2016
I have dynamically popute the data in Dropdownlist(Countries) and the On selected index event of Dropdownlist there is noeed to bind /populate the Checkbox list from database depending on the selections made from the Dropdownlist.
For example If I select Gujrata then all the cities of Gujrat should be visible and bounded to the check box list.
2) Once the checkbox list is bounded with data from the database, We need to select the checkbox from the checkboxlist and pass tyhe selected text of all the selected checkboxes fro the checkbox list as comma seperated values to database and then I need to Display in the Grid.
Below is my code for Dynamically populated/Bind DropDown list and get the States:
ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MachineCode.aspx.cs" Inherits="SampleApp.MachineCode" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
[Code] .....
View 1 Replies
Oct 18, 2010
I have created a composite control with sample details as follows. Basically, the first time on page load the control sets a view state variable and the problem is that on post back (when the button is clicked), the ViewState variable is null. I have researched extensively and I am not able to find a solution. I checked all the Microsoft recommended articles and also from other developers. This approach seem to work for everyone
PS: This code may not work as it is only for illustrative purposes. but this is exactly what i'm doing in my code.
Public class Test : CompositeControl
{
private Button btnTest = new Button();
public string TestViewState[code]....
View 2 Replies
Aug 12, 2010
know how to set focus for checkboxlist.
View 7 Replies
Apr 30, 2010
I have a form with 2 sections. The first one contains some radio buttons. The second one contains a checkboxlist. When we change the selected radio button then it modifies the elements in the checkboxlist. For this I setted the radio buttons with autopostback, and in the code behind (in OnLoad) I populate the CheckBoxList depending on the selected radio button.
This work fine.
The problem is that I also have a button at the end of my form which post the data of my form in another page (with PostBackUrl). Then in that page I would like to retrieve the values of the checked checkbox. But I can't find how to do that. In the Request.Form I don't see anything.
I searched on the web but I didn't found really a solution.
View 3 Replies
Jun 25, 2010
I have an asp.net page with some JQuery tabs. Everything works ok.I added a dropdownlist in one of the tabs, that causes a postback. After the postback I want the same tab to be selected.I initialize the tabs as:
<script type="text/javascript">
$(document).ready(function() {
var $myTabs = $(".tabsDiv").tabs();
</script>
Then, on the PageLoad event, I inject a script to select the tab:
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "TabSelect", "$myTabs.tabs('select', 1);", true);
For some reason this doesn't work. The script is running but the tabs are not selected.Is it because the RegisterClientScriptBlock places the script in the bottom of the page and, for some reason, it runs too late?
View 2 Replies
Oct 26, 2010
If I have a list of radiobuttons like this:
[Code]....
, when submitting the form and return the untyped View again, the selection is lost. What is the best practise to overcome this in MVC?
My submit-action looks like this as I am also passing an uploaded file...
[Code]....
View 2 Replies
May 6, 2010
I have a search page with a TextBox that allows someone to type in a search term and press enter. (Which fires TextChanged). I have a DropDownList that specifies the kind of search that will be performed. It is defined in the markup as follows:
<asp:DropDownList ID="lstSearchType" runat="server" AutoPostBack="false">
<asp:ListItem Value="0">Last, First</asp:ListItem>
<asp:ListItem Value="1">Last</asp:ListItem>
<asp:ListItem Value="2">First</asp:ListItem>
<asp:ListItem Value="3">Liberty ID</asp:ListItem>
<asp:ListItem Value="4">E-mail</asp:ListItem>
<asp:ListItem Value="5">Telephone</asp:ListItem>
<asp:ListItem Value="6">Birthday (exact m/d/yyyy)</asp:ListItem>
<asp:ListItem Value="7">SSN (exact ###-##-####)</asp:ListItem>
<asp:ListItem Value="8">Address</asp:ListItem>
</asp:DropDownList>
As you can see, AutoPostBack is set to false, and there is no event hookup.
Pressing enter fires the OnTextChanged event for the TextBox, which performs a search and updates a GridView in an UpdatePanel. This UpdatePanel has its UpdateMode set to conditional and has one trigger: the TextChanged event of the search TextBox.
It's very simple.
And it works beautifully, almost.
Whenever I change the search type, the very next search does a full postback. All subsequent searches do partial postbacks (as desired) unless I change the search type again.
There is one exception to this rule: if I load the page and immediately change the search type, it doesn't do a full postback. So the first change of the DropDownList before any postback (full or partial) does not trigger a full postback.
Full Disclosure: I'm doing a lot of JavaScript to change the appearance of the gridview during async requests. I don't detail it here because it seems unrelated. This problem only occurs when a DropDownList with no JavaScript wired up is changed.
View 1 Replies
Oct 19, 2010
I have been having some trouble with dropdown lists reverting back to selecting the initial item in the list after a postback once a selection has been made from the dropdown list. I have read up on this and found out that a "if not ispostback then" is required.This works fine when I add in all the items in the dropdown list manually like:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
ddl1.Items.Add("Select...") [code]....
However, I have over 250 items and so it is far more efficient for me to load then in by using part of a multidimensional array which is created from a text file - Definitive database.txt. I have been using the following code to do so:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
'loads the definitive database array[code]...
This loads all the items into the dropdown list perfectly, but now every time a selection is made, it reverts back to the inital item on postback even though i have included the "if not ispostback then" part.
View 3 Replies
Jun 23, 2010
I'm trying to put a updateprogress into a webpage where selection from the dropdownlist causes postback. Works out well except that on the first postback, the gif image shows on the leftside rather than on the center. On succeeding postback, it will show on the centre where I intend it to be. Below is my code:
[Code]....
View 2 Replies
Aug 6, 2013
I have two dropdownlists on my page that are related to one another, and are built dynamically. I did not write the original code, but I believe it is using AJAX so the whole page doesn't postback when the ddl selection changes. The first ddl is Status and the second is ContractType. Here is the code for the event handler:
Code:
protected void Status_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
DropDownList status = (DropDownList)sender;
string selectedStatusId = status.SelectedItem.Value;
[Code] ....
Here is some of my debugging info:
? view.Count
4
? view.Table.Rows.Count
20
? contractTypeDropDown.SelectedValue
[Code] .....
I commented out the event handler since this snapshot, just to see what would happen, but when I was hitting it you can see what ex.Message was. I don't understand why it says the SelectedValue is invalid when I see the selected value is "E " and that is one of the four items in the ddl.
View 1 Replies
May 5, 2010
I have an asp:ListBox which contains a list of countries. Users select one or more countries and then assign them to another list box on the page.
<asp:ListBox id="countrylist" runat="server" SelectionMode="Multiple" AutoPostBack="True" CssClass="inputC" OnSelectedIndexChanged="countrylist_SelectedIndexChanged"></asp:ListBox>
In Internet Explorer, if I scroll down (say to United States) and then click it, the list scrolls back to the top. United States is still selected, if I press the "Assign" button it will appear within the second list box, and if I scroll down I can see that United States is still selected.
However, users are complaining about this, especially since it happens so quickly that they can't select multiple countries.
I tried using smartnavigation and MaintainScrollPosition, but this has had no effect.
<%@ Page Language="C#" smartNavigation="true" MaintainScrollPositionOnPostback="true" AutoEventWireup="true" EnableEventValidation="false" MasterPageFile="MasterPage.master" CodeFile="form.aspx.cs" Inherits="forms_template" %>
This behaviour is not exhibited in Firefox.
View 2 Replies