Link to home
Start Free TrialLog in
Avatar of Rajkumar Gs
Rajkumar GsFlag for India

asked on

Button event not triggering after Radgrid event

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

Avatar of Fahad Pathan
Fahad Pathan
Flag of India image

U have to put ur button outside ur update panel...
Avatar of Rajkumar Gs

ASKER

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
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.
akindelu,

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

Raj
What action you are doing on button click?
saving data
will it require complete postback of the page?
what action are you performing on this IsFieldMissingCheckBox_CheckedChanged method.
if you can provide with code too
>> 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
try using trigger tag in ur update panel, where control as ur button and event of it as in event of TAG.
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
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

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
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
Sampple code is working on wich machine.. with SP1 or Without SP1... if so den u ve got ur answer...
so try installing VS2008 SP1 on the other machine, that might be the problem.
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
Sorry Ignore my last post
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
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
saini, i agree totally, but what about giving it a try it could be a bug in SP1.
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
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

Did you get any clue on it ?
Raj
Thanks pathan, I will try this solution and let you know.

Raj
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
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
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
u can tell me what error msg u are getting now?
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
SOLUTION
Avatar of Fahad Pathan
Fahad Pathan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks pathan, I will try it on Monday and let you know

Raj
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
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
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.
@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 :)
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