I am working with grid view ..and databinding in that grid view is work perfectly.
But when i am tring to handle any GridView Events Like OnSorting,OnPageIndexChanging,OnRowCommand and OnRowDeleting i am getting this error.
"Uncaught Sys.ArgumentTypeException: Sys.ArgumentTypeException: Object of type 'Sys.Extended.UI.TextBoxWrapper' cannot be converted to type 'Sys.Extended.UI.TextBoxWrapper'. Parameter name: instance "
I would like to clarify that if i use Page that contain this Grid(Child page) in tab structure contain by other page(Parent Page) then only i face this Problem. else i am able to handle all GridViews's Event if i open Directly this page(Child Page)
in Browser.
You'll see if the tab structure you use sends postbacks to the server. These GridView events require full postbacks. If you are using some AJAX controls, you may have the issues. So consider use normal links for your tab structure. You can yet use CSS to
style these links that have Tabs visusal effect. For example,
http://clagnut.com/sandbox/csstabs/
Maahi
0 Points
6 Posts
Error in GridView Events
Aug 16, 2012 08:12 AM|LINK
Hello,
I am working with grid view ..and databinding in that grid view is work perfectly.
But when i am tring to handle any GridView Events Like OnSorting,OnPageIndexChanging,OnRowCommand and OnRowDeleting i am getting this error.
"Uncaught Sys.ArgumentTypeException: Sys.ArgumentTypeException: Object of type 'Sys.Extended.UI.TextBoxWrapper' cannot be converted to type 'Sys.Extended.UI.TextBoxWrapper'. Parameter name: instance "
please help me...
Keyur Shah
Participant
1002 Points
278 Posts
Re: Error in GridView Events
Aug 16, 2012 08:13 AM|LINK
Can you post your code here?
Maahi
0 Points
6 Posts
Re: Error in GridView Events
Aug 16, 2012 08:23 AM|LINK
In aspx page i have this code..
<asp:GridView ID="gdvPayment" runat="server" AutoGenerateColumns="False" AllowSorting="True"
Width="100%" BorderWidth="1px" BorderStyle="Solid" GridLines="None" ShowFooter="true"
CellPadding="5" AllowPaging="false" DataKeyNames="PaymentId" OnRowDataBound="gdvPayment_RowDataBound"
OnPageIndexChanging="gdvPayment_PageIndexChanging" OnSorting="gdvPayment_SortCommand"
OnRowCommand="gdvPayment_Edit" OnRowDeleting="gdvPayment_Delete">
<HeaderStyle HorizontalAlign="Center" Height="37px" CssClass="ui-widget-header" VerticalAlign="Middle"></HeaderStyle>
<PagerStyle Width="100%" HorizontalAlign="Left" CssClass="ui-state-hover" ></PagerStyle>
<RowStyle CssClass="ui-state-default" Height="40px" VerticalAlign="Middle" HorizontalAlign="Center" />
<AlternatingRowStyle CssClass="ui-state-default" HorizontalAlign="Center" />
<Columns>
<asp:TemplateField HeaderText="Sr.<br/>No" SortExpression="FinalAmount">
<ItemTemplate>
<asp:Label ID="lblSerialNo" runat="server" Text="" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="PaymentDate" HtmlEncode="false" HeaderText="Payment<br/>Date" DataFormatString="{0:dd/MM/yyyy}" SortExpression="PaymentDate"/>
<asp:BoundField DataField="AmountUS" HtmlEncode="false" HeaderText="Amount<br/>(US $)" DataFormatString="{0:0.00}" SortExpression="AmountUS" />
<asp:BoundField DataField="ConversionRate" HtmlEncode="false" HeaderText="Conversion<br/>Rate" DataFormatString="{0:0}" SortExpression="ConversionRate" />
<asp:BoundField DataField="AmountINR" HtmlEncode="false" HeaderText="Amount<br/>(INR)" DataFormatString="{0:#,###.00}" SortExpression="AmountINR" />
<%-- <asp:BoundField DataField="ModeOfPayment" HeaderText="ModeOfPayment" SortExpression="ModeOfPayment" />--%>
<asp:TemplateField HeaderText ="Mode Of<br/>Payment">
<ItemTemplate>
<div>
<%# Enum.GetName(typeof(DataAccess.clsPayment.ModeOfPaymentEnum), Convert.ToInt32(Eval("ModeOfPayment")))%>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="TaxPercentage" HtmlEncode="false" HeaderText="Tax<br/>(%)" DataFormatString="{0:0}%" SortExpression="TaxPercentage" />
<asp:BoundField DataField="TaxMoney" HtmlEncode="false" HeaderText="Tax<br/>(INR)" DataFormatString="{0:#,###.00}" SortExpression="TaxMoney" />
<%--<asp:TemplateField HeaderText="Add By" SortExpression="AddBy">
<ItemTemplate><%# Eval("UserName")%>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField HeaderText="Final<br/>Amount" SortExpression="FinalAmount">
<ItemTemplate>
<asp:Label ID="lblFinalAmt" runat="server" Text='<%# Eval("FinalAmount","{0:0.00}") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lblTotalFinalAmt" runat="server" />
</FooterTemplate>
</asp:TemplateField>
<asp:BoundField DataField="UserName" HeaderText="Added By" SortExpression="AddBy" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton CommandName="EditPayment" CommandArgument='<%# Eval("PaymentId") %>' ID="lnkBtnEdit" runat="server">Edit</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" ID="lnkBtnDelete" runat="server" OnClientClick="return window.confirm('Are you sure to delete this Work Log Entry?');">Delete</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
and in aspx.cs i have handle that event like this way.
protected void gdvPayment_Edit(object sender, GridViewCommandEventArgs e)
{
}
Keyur Shah
Participant
1002 Points
278 Posts
Re: Error in GridView Events
Aug 16, 2012 08:36 AM|LINK
Maahi Check this http://sympmarc.com/2010/08/28/how-to-fix-sys-argumenttypeexception-object-of-type-sys-_application-cannot-be-converted-to-type-sys-_application-error/
may be this is the same problem as your.
Maahi
0 Points
6 Posts
Re: Error in GridView Events
Aug 16, 2012 09:43 AM|LINK
Thank you.
but it doesn't work.
Maahi
0 Points
6 Posts
Re: Error in GridView Events
Aug 16, 2012 10:39 AM|LINK
If i add ScriptMode = "Release" in scriptManager then i got this error.
<div class="console-message console-error-level">-
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
</div> <div class="console-message console-error-level">-
- <div></div>
- <div></div>
- <div></div>
- <div></div>
</div>Maahi
0 Points
6 Posts
Re: Error in GridView Events
Aug 16, 2012 01:37 PM|LINK
Hello,
I would like to clarify that if i use Page that contain this Grid(Child page) in tab structure contain by other page(Parent Page) then only i face this Problem. else i am able to handle all GridViews's Event if i open Directly this page(Child Page) in Browser.
If anybody have solution please help me out...
chetan.sarod...
All-Star
65619 Points
11118 Posts
Re: Error in GridView Events
Aug 17, 2012 03:47 AM|LINK
Refer this
http://blogs.msdn.com/b/codefx/archive/2009/09/07/how-to-implement-insert-edit-delete-paging-and-sorting-functions-in-an-asp-net-gridview-control.aspx
http://blogs.msdn.com/b/codefx/archive/2009/09/07/how-to-implement-insert-edit-delete-paging-and-sorting-functions-in-an-asp-net-gridview-control.aspx
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
BU XI - MSFT
All-Star
22367 Points
2704 Posts
Microsoft
Re: Error in GridView Events
Aug 21, 2012 04:42 AM|LINK
Hello
You'll see if the tab structure you use sends postbacks to the server. These GridView events require full postbacks. If you are using some AJAX controls, you may have the issues. So consider use normal links for your tab structure. You can yet use CSS to style these links that have Tabs visusal effect. For example, http://clagnut.com/sandbox/csstabs/
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
Maahi
0 Points
6 Posts
Re: Error in GridView Events
Aug 22, 2012 02:30 PM|LINK
Hello,
I had Solved that issue like this Way.
I create one User Control and put Grid in that Control and add that control in Tab. That works.
Thanks For Reply