简体   繁体   中英

Radiobutton selection problem in update panel

I have a gridview inside an updatepanel. It has a TemplateField column with radiobutton:

<asp:GridView ID="gridView_stLists" runat="server" AutoGenerateColumns="False" CellPadding="3"
                                                    BorderStyle="NotSet" CssClass="table_layout" Width="500">
                                                    <RowStyle CssClass="table_body" />
                                                    <Columns>
                                                        <asp:TemplateField HeaderStyle-Width="20">
                                                            <ItemTemplate>
                                                                <asp:RadioButton ID="rdBtn_stdl" runat="server" 
                                                                    oncheckedchanged="rdBtn_stdl_CheckedChanged" AutoPostBack="True" 
                                                                    GroupName="stdl" value='<%# Eval("uri") %>'/>
                                                            </ItemTemplate>
                                                            <HeaderStyle Width="20px" />
                                                        </asp:TemplateField>

And i have the eventhandler for CheckedChanged. My problem is , firstly, with autopostback true, when I select radio in grid, selection disapears. Secondly, with autopostback true or false, the eventhandler is not fired. Could you please help in this situation

My guess is that you are rebinding the gridview on your postback, which will screw up the association of eventhandlers to templates for certain controls. If you could post some code it would be easier to help though.

You might also see an answer I posted to a similar issue here to give you some ideas: LinkButton command event seems to not be firing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM