.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Viewstate issue when calling button click event from Javascript

Posted By:      Posted Date: September 09, 2010    Points: 0   Category :ASP.Net
I have a javascript that asks a confirmation on search click. If the user has made some changes to the data in grid (gridview) on click of Search, a confirmation is asked to Save or Continue Search. If Yes, Save the records by invoking Save click from javascript. If No, Search click is invoked. While Search click happens correctly, Save click results in an error which reads like this..  "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. " I know the Viewstate is what causing the problem, where the control is not loaded but script is trying to invoke it's click event. Any help is appreciated. At the end of the day, all i need is to invoke Save click from javascript.   -- Viswanth VG  

View Complete Post

More Related Resource Links

Calling a button's click event from another buttons click event

I have a button that checks the users serial number entry in a web form and a button that subits the page.  But if the user does not click the checkbutton  I want to  fire the check click event  from the pages submit click event.  Is this possible.  In my submit click event I call this Me.cmdCheck_Click(sender,e) though it does not seem to be firing the click event is there something that I am doing wrong?  

Calling Button,s onclick event in javascript code


 Hi Experts.

I have a Button control in webpage.

<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" OnClientClick="test()"/>

When i click on button, i want to check some conditions

Problem with calling asp button click event from Java script


Dear all ,


I m using these following lines of codes in my java script funtion Save()




var btnSave = document.getElementById('<%=btnSave.ClientID%>');


In ascx,

<asp:Button runat="server" style="display:

disable button in page load click event using javascript



i have button its  enable false in aspx page, if i click the page load  click event  then button should enable

looking forward the reply.

How to call javascript function from Button CLick event



I have a createuserwizard. My CompleteUserWizard in CreateUserWizard is like this..

<asp:CompleteWizardStep ID="MessageStep" runat="server">





  <table style="height: 100%; width: 100%;">


   <td align="center" colspan="2" class="complete_text">






  Your account has been successfully created.




     <td align="center" colspan="2">

    <asp:Button runat="server" ValidationGroup="Createuserwizard1" CommandName="Continue" ID="ContinueButton" CausesValidation="False" Text="Continue" Width="65px" CssClass="Base" />







Javascript button click event oddity in FireFox


Hi Everyone -- This code works fine when outside of an UpdatePanel, but when inside, the server side event never gets called.  It works fine in IE (both inside and outside of an UpdatePanel).

Any Ideas?  Code to repro below:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server"></head>


Reporting services in 2008 r2 how to get a report in a print button click event in my c#.net page


how to  get a report in my c#.net page button lick event also steps to call a report from asp.net to reporting services


Thanks in advance

Infopath button click event in custom workflow code.


Hi All,

I have designed the infopath form(Init) and integrated with my state machine workflow. i want to access button click event (designed in Infopath form) in my workflow code.

Can you help me.




Catch button click event in different .aspx page.


I have a button which starts processing.
I want that when ever a button is click from page1.aspx .. a count down timer should start and displayed on page2.aspx.
I am thinking of using iframe to join 2 pages.

Please let me know your suggestions.


OK button click on Windows dialogue form not triggering click event

I have created an Add-In for Outlook 2003 in Visual Studio 2005. When a new message is sent and a toggle button is selected, a form that I have created will be displayed as a dialogue box, where further information can be entered. Once this information has been entered you can click the OK button and the message is sent. If you were to click the OK button with invalid data in the form, there would be a message box with an error message. This all works perfectly on my development machine but when I have packaged the Add-In and installed it on other machines it does not work. Clicking on the OK button does nothing, there is not even an error message. All the prerequsits are successfully installed and this is the only part of the Add-In that does not work. All help greatly appreciated. Thanks Nick

listview with button in item template - how do I handle the click event?

Hello,Using a listview control for the first time... I need a button for each item, and of course I need to handle the click event for the buttons... upon clicking a particular button I of course need to know which item the button is associated with so the appropriate action can be taken...In VS, I can't select the button and see my list of available events in the properties window like is normally done for controls outside of templates like this... what do I need to do?

How to get the combobox value inside Datagrid on Edit button click event

Hi     I have Datagrid template column like<DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn>DataGridTemplateColumn Header="Edit" x:Name="Edit" ><DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn.CellEditingTemplate></DataGridTemplateColumn>SelectionChanged="cmbDGTeam_SelectionChanged" IsTabStop="True" /></DataTemplate><ComboBox Height="22" IsEditable="True" IsReadOnly="True" ItemsSource="{Binding}" DisplayMemberPath="Title" SelectedValuePath="TeamID" x:Name="cmbDGTeam"  SelectedValue="{Binding Path=TeamID,Mode=TwoWay}"<DataGridTemplateColumn.CellEditingTemplate><DataTemplate><DataTemplate><TextBlock Text="{Binding Title}"/></DataTemplate></DataGridTemplateColumn.CellTemplate><DataGridTemplateColumn Header="Team" Width="75"><DataGridTemplateColumn.CellTemplate> and Edit button Template column <DataGridTemplateColumn Header="Edit" x:Name="Edit" > </DataGridTemplateColumn.CellTemplate></DataTemplate><Button Content="Edit" IsEnabled="False" x:Name="btnEdit" Click="btnEdit_Click" ></Button>&l

Button click event is not fired on button click

 Hi am using jquery flexi gride in web page and it is working fine .But now the problem is ocured when i click button to call server side event.I am not able to find out .Please guide me for this My button is as fallows and i am<asp:Button ID="btnExport" runat="server" Text="Export" Style="font-family: 'Times New Roman', Times, serif" OnClick="btnExport_Click" />  

raise click event from javascript

HiI want to raise click event on linkbutton, when press "Enter ?" on textbox.I wrote this code:LinkButton1.Attributes.Add("onclick", myscript);but, can not call LinkButton1.onclick() , my linkbutton:href='javascript:WebForm_DoPostBackWithOptions(new%20WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$Login1$lbtEnter",%20"",%20true,%20"LoginGroup",%20"",%20false,%20true))'when call ctl00$ContentPlaceHolder1$Login1$lbtEnter.onclick();Error: ctl00_ContentPlaceHolder1_Login1_lbtEnter is not define

Animation on the button click event???

hi, I have prepared a wpf application with 3 buttons. namely: start configure and manual now i want when initially the form loads the only start button should be visible. well not a big task at all!!! i have done it   but:   now i want to make the other two buttons visible and the start button invisible with a bit of animation on the button click event associated with "start" button.   Can any one plz suggest how should i proceed on with??? And ya am using c# for programming the application.....

Browser back button issue when ViewState stored in DB.

I implemented the solution of storing the ViewState in DB (since we were getting lots of Invalid & Corrupt Viewstate errors on our site daily) as given in the following website:http://weblogs.asp.net/adweigert/archive/2004/03/09/86628.aspxThe solution was implemented in one of the aspx pages on our site that behaves like a wizard (not using the wizard control though). After starting to store the viewstate in DB, the Invalid ViewState errors were eliminated completely, but I am now facing the following problem:1) User selects radiobutton1 of the two radiobutton choices on Page 2 of the wizard, a postback happens which displays some extra information on the page based on the selection. Now the user hits the next button on the page that also does a postback & displays Page 3.2) On Page 3, user hits the "back button" of the browser instead of the "previous page" button that is available on that page.3) This displays Page 2 from cache in original state(without any selections made). When user now selects radiobutton2, a postback is supposed to happen, but it does not. User then clicks "next" button on Page 2 (a postback does happen here however), & Page 3 is displayed, but it still thinks that radiobutton1 was selected (the original selection that was made in step1) on the previous page & hence displays information accordingly.I am assumi

Multiple instance of User Control on Page - Button Click Event

Hi, I have this Web User Control, with 3 controls:<asp:TextBox ID="txtSearch" runat="server" /> <asp:RequiredFieldValidator ID="rfvSearch" runat="server" ControlToValidate="txtSearch" Display="None" /> <asp:Button ID="btnSearch" runat="server" onclick="btnSearch_Click" /> In code behind: protected override void Render(HtmlTextWriter writer) { rfvSearch.ValidationGroup = this.ID + "_validation"; txtSearch.ValidationGroup = this.ID + "_validation"; btnSearch.ValidationGroup = this.ID + "_validation"; base.Render(writer); } protected void btnSearch_Click(object sender, EventArgs e) { Response.Redirect("ResultadoSearch.aspx?argumento=" + txtSearch.Text); } When I try to add two UserControl and I Click in btnSearch of second UserControl, txtSearch.txt returns value of first User control.How I can get the value of second txtSearch?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend