C# - ViewState Doesn't Work When Control Become Enable=False
May 26, 2010
Why when a control does contain value but it's set to .Enable=False that all controls become disable (that's ok) but why that the ViewState doesn't retain the data on the next post back? If I get the UserControl without modifing its Enable state, the ViewState work between post back.
How can we disable a UserControl that all its control become disable (this part work) but all of them KEEP use the ViewState (this doesn't work)?
Clarification:
1)In the aspx.cs click button EDIT:
myControl.Enabled = false;
//This produce to have all controls in myControl to be disabled.
2)In the asp.cs: click Save to leave the EDIT state:
myControl.Enabled = true;
//This produce that all controls inside myControl are blank : no viewstate!
Other postback works because we do not put myControl.Enable to false.
well the thing i am doing is that and returning a formviewdal ,there is a page refresh while performing validation ( it work fine when i return only modal ,but is not working
when i am returning formviewmodal i.e doing a page refresh) ,What might be wrong. Review the create below as it is returning viewmodal class
I have two update panels and in the second update panel i have asp.net button and onclick of the button in codebehind i have disabled it like btnAddSecurity.Enabled = false;
When I disable the button i enable a cancel button before it and on cancel button when i try to enable the btnAddSecurity.Enabled = true it simply doesn't work. Both of my updatepanels updatemode is conditional. what is the problem?
I just want to add some client side (JQuery Javascript) validation in a web user control. I put an OnClientClick handler and the function gets called. BUT, even if I return "false", the OnClick method always get fired. What am I doing wrong ?
I'm with VS 2010, targeting the 4.0 framework with JQuery 1.4.2. and JQuery UI 1.8.4.
I have a webdayview control (Infragistics proprietary ASP.net control) on my page. On the aspx source I've inserted some javascript (webdayview_click - clientside click event) that calls a webmethod in the codebehind. This seems to work fine, but when I insert this webdayview control into a user control and move the corresponding javascript into the aspx of the user control, it doesn't work. I can't even insert a breakpoint into the javascript function to debug it. Is there a way to make it work? I want to enable the click event of the webdayview control so that when I click on it, the javascript function calls the webmethod. Here's my code (remember it is inside a user control):
[code]...
I posted this question on the Infragistics forum but didn't get any replies. Hopefully I'll get some here. :)
I have a Gridview that has some controls above you can use to select how much data the Gridview displays - a week's worth, a month's worth, a year's worth etc.
And, as it's a view only grid, I thought 'I'll keep the page size down by doing this:
<asp:GridView EnableViewState="false" etc.
But, if I look at a year's worth of data and look at Page Source - the ViewState is massive. If I look at a week's work, the ViewState is small. A month's worth - a bit bigger and so on.
So, despite setting EnableViewState to false - the ViewState does seem to grow in proportion to the data being displayed in the Grid. I don't need all that data held in ViewState so why is it happening?
The following is trimmed down from the web.config file I'm using in a website that runs in Windows 2003 R2.
<system.web> <!-- Required to use BetterImageLink and BetterImage class --> <httpHandlers> <remove path="*.asmx" verb="*" />
[Code]....
I'm migrating the site to a new server running Windows 2008 R2. When I tested the site, I fould that the BetterImage control doesn't work. I use the BetterImage control liberally throughout the site, so this is a real problem for me. I emailed the developer and he responded that I have to change the location in the web.config where I register my custom handlers. How do I do that? And are there any other changes I need to be aware of? How different is the web.config between the two Windows versions?
I can't get my <ajax:asyncfileupload> working and I don't see why...
When outside any panel or table it is working well, but as soon as I put it in a <asp:panel> or table I get a strange error which seems to be on client-side but I don't understand what's happen here. Here is the code and code-behind and Javascript.
Here's the error:
[URL]
Here's my front-code:
[Code]....
Protected Sub fupAjoutLogo_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs)
I am having quite a bit of trouble getting an accordion control to work. I downloaded the AJAX Control Toolkit (v 3.5), added the dll to my toolbox, and added an accordion control with the following code:
I want to disable viewstate for nearly all of my pages and I have used the element to do so in my web.config.On a page that specifically uses viewstate, I used the EnableViewState=true. However the page fails to work and the dropdownlists that depended on viewstate are not filled in the postback.How can I enable ViewState for some Pages when it is disabled in WebConfig?
My button in user control doesn't work /its click event doesn't fire/. This user control is on the page that inherits from master page. Although, the user control buttons on the master page work correctly.
i am using mod_aspdotnet.so module to hosting my ASP.NET application. all was ok until i use ajax control tool kit in my aplication. I am using ajaxToolkit:CascadingDropDown to conect 2 dropdownlist in cascade. In IIS every thing works fine, but in apache there are some problems. When load the page, i got the next javascript error: 'Sys' undefined. the object signed are :
and on change of this dropdownlist i check if the its text equal to a string i show the 2 tr as below
function ValidateCity() { if ($('#<%= citiesDropDownList.ClientID %> :selected').text() == identity_CityOther) { $('#<%= otherCityTR.ClientID %>').show(); $('#<%= areasTR.ClientID %>').show(); } var city = $('#<%= citiesDropDownList.ClientID %>').val(); return IsValid((city.length != 0), '#<%= cityDiv.ClientID %>', identity_CityRequired); }
.show() isn't work at all and i don't the reason .. can any lead me to get the problem?
FYI : I tried $('#<%= otherCityTR.ClientID %>').show('slow'); and also $('#<%= otherCityTR.ClientID %>').css('visibility', 'visible'); but it doesn't work also.
i am using VS2008, 3.5 .net and have installed ajax control toolkit and added controls into toolbox, that was fine. But, i can't get any of control to work, nor it renders in design view on my page. Control source is created, page builds without errors but controls don't work. For example:
i want to ask question i have simple regular expression pattern like "[ABC]" when i add it to me class
[Code]....
it is working good when i add A , B Or C as i need.but if i copy this pattern and paste it in my regular expression validator control it is not working