Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Atlas Update Panel Gridview select command

Status
Not open for further replies.

CassidyHunt

IS-IT--Management
Joined
Jan 7, 2004
Messages
688
Location
US
I have an update panel that contains several controls including a gridview. The button trigger works great for populating the gridview. However when I use the select button on the gridview I get a javascript error.

Does anyone know why and how to fix it?

There error is Javascript object expected in the:
__doPostBack('GridView1','Select$0')

Here is my ASP.Net Code
Code:
<atlas:UpdatePanel ID="up1" runat="server" RenderMode="inline" EnableViewState="True">
            <ContentTemplate>
            <div id="report_form">
                <asp:TextBox ID="criteria" runat="server" />
                <asp:Button ID="btnUpdate" runat="server" Text="Get Data" OnClick="btnUpdate_Click" />
                <br />
            </div>
            <div id="report_data">
                <asp:SqlDataSource ID="cust_order_line" runat="server" ConnectionString="<%$ ConnectionStrings:VMFGConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:VMFGConnectionString.ProviderName %>" SelectCommand="select * from br_cust_order_line where upper(cust_order_id) = upper(:id)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="criteria" Name="id" PropertyName="Text" />
                    </SelectParameters>
                </asp:SqlDataSource>

                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
                    DataSourceID="cust_order_line" Width="100%" ShowFooter="True" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" GridLines="Horizontal" >
                    <Columns>
                        <asp:CommandField ShowSelectButton="True"  CausesValidation="False" />
                        <asp:BoundField DataField="LINE_NO" HeaderText="Line No" SortExpression="LINE_NO" >
                            <ItemStyle HorizontalAlign="Left" />
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:BoundField>
                        <asp:BoundField DataField="PART_ID" HeaderText="Reference" SortExpression="PART_ID" >
                            <ItemStyle HorizontalAlign="Left" />
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ORDER_QTY" HeaderText="Quantity" SortExpression="ORDER_QTY" >
                            <ItemStyle HorizontalAlign="Right" />
                            <HeaderStyle HorizontalAlign="Right" />
                        </asp:BoundField>
                        <asp:BoundField HtmlEncode="False" DataField="UNIT_PRICE" HeaderText="Unit Price" SortExpression="UNIT_PRICE" DataFormatString="{0:C2}" >
                            <ItemStyle HorizontalAlign="Right" />
                            <HeaderStyle HorizontalAlign="Right" />
                        </asp:BoundField>
                        <asp:BoundField DataField="TRADE_DISC_PERCENT" HeaderText="Discount" SortExpression="TRADE_DISC_PERCENT" DataFormatString="{0:P2}" HtmlEncode="False" >
                            <ItemStyle HorizontalAlign="Right" />
                            <HeaderStyle HorizontalAlign="Right" />
                        </asp:BoundField>
                        <asp:BoundField DataField="TOTAL_PRICE" HeaderText="Price" SortExpression="TOTAL_PRICE" DataFormatString="{0:C2}" HtmlEncode="False" >
                            <ItemStyle HorizontalAlign="Right" />
                            <HeaderStyle HorizontalAlign="Right" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ACTUAL_COST" HeaderText="Cost" SortExpression="ACTUAL_COST" DataFormatString="{0:C2}" HtmlEncode="False" >
                            <ItemStyle HorizontalAlign="Right" />
                            <HeaderStyle HorizontalAlign="Right" />
                        </asp:BoundField>
                        <asp:BoundField DataField="GROSSPROFIT" DataFormatString="{0:P2}" HeaderText="Gross Profit" SortExpression="GROSSPROFIT" HtmlEncode="False" >
                            <ItemStyle HorizontalAlign="Right" />
                            <HeaderStyle HorizontalAlign="Right" />
                        </asp:BoundField>
                    </Columns>
                    <EmptyDataTemplate>
                        Please supply a current sales order.
                    </EmptyDataTemplate>
                </asp:GridView>
                <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
                </div>
            </ContentTemplate>
            <Triggers>
                <atlas:ControlEventTrigger ControlID="btnUpdate" EventName="Click" />                
                <atlas:ControlEventTrigger ControlID="GridView1" EventName="SelectedIndexChanged" />
            </Triggers>
        </atlas:UpdatePanel>

Thanks

Cassidy
 
Does whatever you are trying to do work without the atlas update panel? If so, then you will probably get better advice from the actual Atlas forums:



____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Works perfectly without the update panel. I posted there as well just waiting for approval. From what I can tell the gridview forces a postback with the proper arguements then the update panel fires its method which causes the error. How to get around this or disable the postback method of the gridview is beyond me.
 
Well the solution was very simple. Just add another gridview outside of the update panel and set its visibility/display property so that it is hidden. This will add the _dopostback javascript method and enable the updatepanel to handle the control.

It seems like a bug in the update panel to me but as long as it works who am I to complain.

Thanks

Cassidy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top