<ajax:UpdatePanelID="UpdatePanel1"runat="server">
<ContentTemplate>
<asp:GridViewID="GridView1"runat="server" AutoGenerateColumns="False"DataKeyNames="ID"DataSourceID="ap"OnDataBound="GridView1_DataBound" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" >
<Columns>
<asp:BoundFieldDataField="Class"/>
<asp:BoundFieldDataField="Sector"/>
<asp:BoundFieldDataField="Name"/>
<asp:CommandFieldButtonType="Image"SelectImageUrl="~/images/extras/preview.png"ShowSelectButton="True"/>
</Columns> </asp:GridView>
</ContentTemplate>
</ajax:UpdatePanel>
<asp:SqlDataSourceID="ap"runat="server"ConnectionString="<%$ ConnectionStrings: ConnectionString%>"
SelectCommand="SELECT * FROM group >
</asp:SqlDataSource>
ProtectedSub GridView1_SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles GridView1.SelectedIndexChanged
FVTransaction.ChangeMode(FormViewMode.Insert)
Dim ClassAsString = GridView1.SelectedRow.Cells(0).Text
Dim SectorAsString = GridView1.SelectedRow.Cells(1).Text
Dim NameAsString = GridView1.SelectedRow.Cells(2).Text
Dim PClassAs TextBox =CType(FVTransaction.FindControl("FVClass"), TextBox)
Dim PSectorAs TextBox =CType(FVTransaction.FindControl("FVSector"), TextBox)
Dim PNameAs TextBox =CType(FVTransaction.FindControl("FVName"), TextBox)
PClass.Text = Class.ToString
PSector.Text = Sector.ToString
PName.Text = Name.ToString
EndSub
Thanks for your help.
wow, your formatting makes it really hard to keep track of where stuff is...I couldn't find the formview on there.
anyway, if I had to guess, i'd say that your formview isn't in an updatepanel. Try putting it in one (the same or different, shouldnt' matter) and that should do the trick.
sorry for the formatting, when I paste it, it looked great but then I don't know what happened. I fixed it now.
For your question, Unfortunatelly I can't have the formView inside the same panel as GridView because of the page design template. Is there an another work around?
Thanks
Thank you for your suggestion. I thought I need to have the GridView and FormView in the same updatepanel. But When I put formview another updatepanel, it worked.
Thanks
Glad I could help.
No comments:
Post a Comment