Solved

Button event not triggering after Radgrid event

Posted on 2010-08-24
44
4,265 Views
Last Modified: 2012-05-10
In one of my ASPX pages, I am using a 'RadGrid' control and two buttons.
When the page is loaded, I click on the button it is working. But If I am clicking on the button after click on any checkbox inside the Radgrid, the button event is not triggering.

ASPX page code is attached.

Can you assist me on this issue ?
I am checking on this issue. Since I am very near the deadline, I need another brain.

Raj
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MApplicationMissingData.aspx.cs"

    MaintainScrollPositionOnPostback="true" Inherits="MDXIAS.Applications.MApplicationMissingData" %>



<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!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 id="Head1" runat="server">

    <title>SS</title>

</head>

<body>

    <form id="MAppMissngDatafrm" runat="server">

    <telerik:RadScriptManager ID="RdScptMgrMAppMissngData" EnablePartialRendering="true"

        AsyncPostBackTimeout="36000" runat="server">

    </telerik:RadScriptManager>

    <telerik:RadStyleSheetManager ID="RdStyMgrMAppMissngData" EnableStyleSheetCombine="true"

        runat="server">

    </telerik:RadStyleSheetManager>

    <div class="contentcontainer">

        <table style="width: 100%" border="0">

            <tr style="height: 400px; vertical-align: top;">

                <td>

                    <table width="100%">

                        <tr>

                            <td>

                                <fieldset style="width: 100%; height: 93%">

                                    <asp:UpdatePanel ID="uxMissingDataGridPanel" runat="server" UpdateMode="Conditional">

                                        <ContentTemplate>

                                            <table width="100%">

                                                <tr>

                                                    <td style="text-align: center;">

                                                        <div style="overflow: auto; height: 370px; width: 100%">

                                                            <telerik:RadGrid ID="MissingDataGrid" runat="server" AutoGenerateColumns="False"

                                                                GridLines="None" Skin="Office2007" Width="97%">

                                                                <MasterTableView DataKeyNames="ID">

                                                                    <RowIndicatorColumn>

                                                                        <HeaderStyle Width="20px" />

                                                                    </RowIndicatorColumn>

                                                                    <ExpandCollapseColumn>

                                                                        <HeaderStyle Width="20px" />

                                                                    </ExpandCollapseColumn>

                                                                    <Columns>

                                                                        <telerik:GridBoundColumn DataField="SNO" DataType="System.Int32" HeaderStyle-Width="5%"

                                                                            HeaderText="Sl. No" ReadOnly="True" SortExpression="SNO" UniqueName="SNO">

                                                                            <HeaderStyle Width="5%" />

                                                                        </telerik:GridBoundColumn>

                                                                        <telerik:GridBoundColumn DataField="FieldName" HeaderText="Information" SortExpression="FieldName"

                                                                            UniqueName="FieldName">

                                                                        </telerik:GridBoundColumn>

                                                                        <telerik:GridTemplateColumn HeaderStyle-Width="10%" HeaderText="Missing Fields">

                                                                            <ItemTemplate>

                                                                                <asp:CheckBox ID="IsFieldMissingCheckBox" runat="server" AutoPostBack="true" OnCheckedChanged="IsFieldMissingCheckBox_CheckedChanged"

                                                                                    Checked='<%# DataBinder.Eval(Container.DataItem, "Active")%>' CssClass="check" />

                                                                            </ItemTemplate>

                                                                            <HeaderStyle Width="10%" />

                                                                        </telerik:GridTemplateColumn>

                                                                        <telerik:GridTemplateColumn HeaderText="Description" Visible="False">

                                                                            <ItemTemplate>

                                                                                <asp:TextBox ID="uxTextBox" runat="server"></asp:TextBox>

                                                                            </ItemTemplate>

                                                                        </telerik:GridTemplateColumn>

                                                                        <telerik:GridBoundColumn DataField="ID" UniqueName="ID" Visible="false">

                                                                        </telerik:GridBoundColumn>

                                                                    </Columns>

                                                                </MasterTableView>

                                                                <FilterMenu EnableTheming="True">

                                                                    <CollapseAnimation Duration="200" Type="OutQuint" />

                                                                </FilterMenu>

                                                            </telerik:RadGrid>

                                                            <br />

                                                        </div>

                                                    </td>

                                                </tr>

                                                <tr>

                                                    <td style="text-align: center;">

                                                        <asp:Button ID="SaveButton" CausesValidation="false" runat="server" Text="Save" CssClass="btns"

                                                            OnClick="SaveButton_Click" />

                                                        &nbsp

                                                        <asp:Button ID="CancelButton" runat="server" Text="Cancel" CssClass="btns" CausesValidation="false"

                                                            OnClick="CancelButton_Click" />

                                                    </td>

                                                </tr>

                                            </table>

                                        </ContentTemplate>

                                    </asp:UpdatePanel>

                                </fieldset>

                            </td>

                        </tr>

                    </table>

                </td>

            </tr>

        </table>

    </div>

    </form>



    <script type="text/javascript" language="javascript">

            function notify() {

                parent.__doPostBack('HiddenRefreshButton', '');

            }

    </script>



</body>

</html>

Open in new window

0
Comment
Question by:Rajkumar Gs
  • 21
  • 10
  • 7
  • +1
44 Comments
 
LVL 2

Expert Comment

by:Fahad Pathan
ID: 33509370
U have to put ur button outside ur update panel...
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33509472
First tab  have the same scenario. Having buttons in update panel. It's working without any issues.
If I am putting it outside the update panel, this issue will be solved, but on click of the button, the tabs gone and all the css formating losed.

I need those buttons to be inside the Update Panel as in first tab.
Can you tell me how to set it up ?

If you want anymore info, plz tell me
Raj
0
 
LVL 5

Expert Comment

by:Akin Delu
ID: 33509495
the button click event get triggered, but you did not notice it because they are in an updatepanel, you can set a breakpoint on the click event method to confirm.
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33509546
akindelu,

I confirmed by breakpoint already. It's not triggering.

Raj
0
 
LVL 2

Expert Comment

by:Fahad Pathan
ID: 33509855
What action you are doing on button click?
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33509973
saving data
0
 
LVL 2

Expert Comment

by:Fahad Pathan
ID: 33509989
will it require complete postback of the page?
0
 
LVL 5

Expert Comment

by:Akin Delu
ID: 33510717
what action are you performing on this IsFieldMissingCheckBox_CheckedChanged method.
0
 
LVL 5

Expert Comment

by:Akin Delu
ID: 33510727
if you can provide with code too
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33511439
>> what action are you performing on this IsFieldMissingCheckBox_CheckedChanged method.
I have removed that code. It was doing nothing and set Autopostback=false. But the bug is not solved by this change

>> will it require complete postback of the page?
No. Just need to save the data in that page.

Now an error message is coming from every second click like "The state information is invalid for this page and might be corrupted. " --- So this may be the issue.

Any idea?
Raj
0
 
LVL 5

Expert Comment

by:Akin Delu
ID: 33512274
0
 
LVL 2

Expert Comment

by:Fahad Pathan
ID: 33512618
try using trigger tag in ur update panel, where control as ur button and event of it as in event of TAG.
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33518147
Hi,

I am not so much expert about Ajax. But your code:

<telerik:RadScriptManager ID="RdScptMgrMAppMissngData" EnablePartialRendering="true"        AsyncPostBackTimeout="36000" runat="server">    </telerik:RadScriptManager>

is the only ScriptManager to control UpdatePanel. And since you have set AsyncPostBackTimeout="36000"  and as much I know about it, it makes request to not to timeout until response is not receive. So my suggestion would be to use your button control in separate update panel or make timeout value less as per your need.

Please rectify me if I am wrong at some point. I think it should work then.

Regards,
VSS
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33518234
Thanks Saini & Pathan for your suggestions.

I tried putting in separate Update Panels, decreased the timout in AsyncPostBackTimeout. - No use :(

I am almost sure that error message coming sometimes - that is causing the problem.
"The state information is invalid for this page and might be corrupted"

Thanks akindelu for the link on that, though I got it previously.
http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/25f2886c-b560-434e-8dab-44a8adf4d34a

Any suggestions on this error
Raj
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33518275
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33518310
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33518774

Totally confusing..! The same source code is working fine in one of our other machine!

Browser is IE 7 on both machines. Same IIS. Difference noted is that I have VS2008 SP1, while other machine have only VS2008 without SP1.

Any thoughts?
Raj
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33518786
Hi,

The same source code is working fine in one of our other machine!

So try deleting temporary files created by the Website in one machine. And also clear all history and cache files of your browser on the machine where the program is not working fine.

I hope that would resolve the matter.

Regards,
VSS
0
 
LVL 2

Expert Comment

by:Fahad Pathan
ID: 33518795
Sampple code is working on wich machine.. with SP1 or Without SP1... if so den u ve got ur answer...
0
 
LVL 5

Expert Comment

by:Akin Delu
ID: 33518939
so try installing VS2008 SP1 on the other machine, that might be the problem.
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33519580
I know what answer you are expecting :)

But fun is that it's NOT working on VS 2008 with SP1 (other machine) and working fine on VS 2008 without SP1 (my machine)

Raj
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33519583
Sorry Ignore my last post
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33519589
Sorry for wrong entry - as I am already mad :(

But fun is that it's NOT working on VS 2008 with SP1 (MY machine) and working fine on VS 2008 without SP1 (OTHER machine)

Raj
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33519726
Hi,

If the problem on machine with SP1 then we all have still not solved the problem. The problem continues. You cannot say that for solution to downgrade to without SP1

Regards,
VSS
0
 
LVL 5

Expert Comment

by:Akin Delu
ID: 33519804
saini, i agree totally, but what about giving it a try it could be a bug in SP1.
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33519946
Hi akindelu,

I wish if I could and other experts could also test the same bug within their system. If we all get same problem as discussed then we can officially declared it as bug (either in Radgrid control or in SP1).

So would the solution to this problem will be to run this program on system without SP1 configuration. If it is and yes it is being this would be something very odd solution.

But let's see what Author declare as solution.

Regards,
VSS
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33521997
Thanks guys to keep in touch!

Since today is our target date to finish the tasks, temporarily i am doing my code in my machine and will test it in the working machine! A walk around between two machines. Since no time to find out the solution today.

In my machine (where not working), from view source of the error message, I am attaching the error message related to Invalid Viewstate.

Raj
[FormatException: Invalid character in a Base-64 string.]

   System.Convert.FromBase64String(String s) +0

   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72

   System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4

   System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37

   System.Web.UI.HiddenFieldPageStatePersister.Load() +113



[ViewStateException: Invalid viewstate. 

	Client IP: 127.0.0.1

	Port: 1247

	User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)

	ViewState: /wEPDwUKLTQ3OTcyMjM3OQ9kFgICAw9kFgICBQ9kFgJmD2QWBAIBD2QWAgIBDzwrAA0CABQrAAIPFgYeC18hRGF0YUJvdW5kZx4LXyFJdGVtQ291bnQCAR4LRWRpdEluZGV4ZXMWAGQXAQUPU2VsZWN0ZWRJbmRleGVzFgABFgIWCg8CBhQrAAYUKwAFFgIeBG9pbmQCAmRkZAUDU05PFCsABRYEHghEYXRhVHlwZRkrAh8DAgNkZGQFCUZpZWxkTmFtZRQrAAUWAh8DAgRkZGQFDlRlbXBsYXRlQ29sdW1uFCsABRYCHwMCBWRkZAUPVGVtcGxhdGVDb2x1bW4xFCsABRYEHwQZKVtTeXN0ZW0uRGVjaW1hbCwgbXNjb3JsaWIsIFZlcnNpb249Mi4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5HwMCBmRkZAUJV2VpZ2h0YWdlFCsABRYEHwQZKwEfAwIHZGRkBQJJRGRlFCsAAAspeVRlbGVyaWsuV2ViLlVJLkdyaWRDaGlsZExvYWRNb2RlLCBUZWxlcmlrLldlYi5VSSwgVmVyc2lvbj0yMDA4LjIuODI2LjM1LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTEyMWZhZTc4MTY1YmEzZDQBPCsABwALKXRUZWxlcmlrLldlYi5VSS5HcmlkRWRpdE1vZGUsIFRlbGVyaWsu...]



[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]

Open in new window

0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33522005
Did you get any clue on it ?
Raj
0
 
LVL 2

Expert Comment

by:Fahad Pathan
ID: 33523477
hi Raj,
Try this solution....
http://support.microsoft.com/kb/323744
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33535015
Thanks pathan, I will try this solution and let you know.

Raj
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33540678
A trick worked for our release. When user clicks save button, after save we reload the page again by calling the entire URL with querystrings.

Raj
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33540922
Hi Raj,

What I was thinking that why there is always a simple,sweet and easy solution to such a hard problems in Development. It's nice that you solve your problem by own.

Thanks for sharing that with us. Happy Coding.

Regard,
VSS
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33555945
As it is not a permanent solution, we are not happy with it. Wonder how to fix it permanently.
Still causing minor issues...
I will update you if we can fix it soon, otherwise will close this question within a week.

If you get any information about this fix, please remember to post it here.

Thanks to all of you for your participation
Raj
0
 
LVL 2

Expert Comment

by:Fahad Pathan
ID: 33558128
u can tell me what error msg u are getting now?
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33558980
As I mentioned I have done a trick by reloading entire pages on save click. that issue is over.

But one of the tabs contain radgrid which have checkboxes in each row. When we check any checkbox, based on the selected checboxes allover the radgrid some calculation is going on.
Only on the first checkbox click, calculation worked. From the second checkbox click onwards no trigger happens (same  issue)

But now I fixed it also by moving the calculation stuff from code-behind code to javascript code. I noticed no probs with javascript code to work. Only server side code is not triggering.

If I am right, we are all stuck (you and me) :) Anyway happy to say that we have overcome those issues by those solutions I mentioned. So supposed to be not a head-ache now.

I will research on how to trace out how to permanently fix it, while getting time.

Raj
0
 
LVL 2

Assisted Solution

by:Fahad Pathan
Fahad Pathan earned 500 total points
ID: 33559704
what u can do is make page go complete post back by registering your control on load event of the page..
I ve also encountered such prob, i just made dat control to post back completely even though it was in AJAX update panel.
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33594875
Pathan,

Please post the code regarding your above suggestion http:#33559704. If you mean some different solution than I tried, I will try your code.

Raj
0
 
LVL 2

Accepted Solution

by:
Fahad Pathan earned 500 total points
ID: 33599450
for doing complete post back for ur button wen u are using ajax update panel,  u can use this Line wen u Load ur page...

ScriptManager.GetCurrent(this).RegisterPostBackControl(SaveButton);

0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33599493
Thanks pathan, I will try it on Monday and let you know

Raj
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33609727
Thanks to trying to help me.

As I mentioned in my comment http:#33558980 other issue have with checkbox buttons in RadGrid.
I am sure till now I have implemented some patch works only till now, which can be say a 'temporary solution'! Real cause of this issue is still not clear.

Let me have some more time and I will update you soon.
Raj
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33700386
HI pathan_fahad,

   ScriptManager.GetCurrent(this).RegisterPostBackControl(SaveButton);

using this above code, can we implement for dropdown select index changed? If the above code we put it right, but the Trigger is necessary in the update panel? I checked it selected index changed for dropdown.If it is postaback occurred my Tab control is gone. what is the problem? Could you give a suggestion please?
Thanks
0
 
LVL 2

Expert Comment

by:Fahad Pathan
ID: 33707697
1. yes. u can u it on any asp control which r in ur update panel which requires complete postback.
2. Check for ur code where u are binding ur tab. Is it on post back of the page. Then u can use !page.ispostback on ur page load.
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33732083
@pathan, Thanks for keep in touch with this question and thereby trying to help me.

This seems to be strange and confusing..!!

Regarding your comment - http:#33599450
When we tried this code
ScriptManager.GetCurrent(this).RegisterPostBackControl(SaveButton);
in Page_Load outside IsPostback, and this control is not specified in the Trigger of UpdatePanel
the 2nd event of Save button not triggering issue is solved!!

So now, when we click on Save button, it will save for any number of clicks. Tabs are not disappearing on this event - so this part is ok!

But when we select first dropdownlist, as I mentioned in the selectindexchanged event of that dropdown, we are binding the second dropdownlist. On the selectindexchanged event of first combo, the tabs are disappearing and all the styles (css properties) of all the controls are losing.

We have tried putting to fix this also in the same manner as we achieved for Save button click.

Case #1:-
We have put the code
ScriptManager.GetCurrent(this).RegisterPostBackControl(DropdownlistName);
in Page_Load outside IsPostback check. And also without this code in PostBack same result.
At the same time, in ASPX page, we tried by including this dropdownlist in Trigger

Result:- In this case when we select first dropdownlist value, selectedindexchanged event of first dropdown is triggering and binding the second dropdownlist, but losing tabs and all styles.

Case #2:- Now we tried by removing the dropdown from Trigger of UpdatePanel and with and without that code in Page_Load - Again happening the same issue i mentioned in the above Result.

My hairs in my head are standing up :)
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 33732133
My comment - http:#33540678 - is also one of the SOLUTION, which worked for me first
But I am accepting pathan_fahad's suggestion - http:#33599450 - as it really sorted out the main issue.

Raj
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
LINQ question 7 22
Align Buttons next to each other 2 13
C# Error - Add Failed 12 52
Birthdays 3 14
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now