When you post a question like this please include the relevant code. It's impossible to help you your code when we have no idea what your code is. How are you databinding your formview? Are you using a DataSource control? Are you binding it in the code behind?
if you go into the configuration wizard for the formview's sql datasource one of the screen's should include a "where" button. If you click that it gives you a screen where you can add filter's to your SqlDataSource and one of the options is to use another
control to provide the value to use.
If you still have problems then post the code for the SqlDataSource for your FormView
hai decker and nakor both of you give me an idea to resolve my isseus..million thank you to both of you....yerterday really tired to look very carefully the confguration..lastly i got the problem .tha
datakeyname is wrong now my gridview and formview work fine thanks again to both of you
afastars
Member
52 Points
221 Posts
Display Selected GridView in FormView
Nov 04, 2012 02:07 PM|LINK
i created one gridview, then on the bottom site i created the formview to display the details of the selected gridview
the problem is when i clik selected user on the gridview there are no formview appear on the buttom site,, really no idea regarding these
already try so many thing, already setup the CommandName "Select" on gridview and formview i also already setup the control and etc
need help
Nakor
Member
336 Points
60 Posts
Re: Display Selected GridView in FormView
Nov 04, 2012 02:20 PM|LINK
When you post a question like this please include the relevant code. It's impossible to help you your code when we have no idea what your code is. How are you databinding your formview? Are you using a DataSource control? Are you binding it in the code behind?
afastars
Member
52 Points
221 Posts
Re: Display Selected GridView in FormView
Nov 04, 2012 02:39 PM|LINK
i'm using sql datasouce in gridview ,also in formview using sqldatasource
this is my gridview code
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="IdMerit"
DataSourceID="SqlDataSource2" CellPadding="4" ForeColor="#333333" GridLines="None" Width="522px">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:BoundField DataField="Tarikh" HeaderText="Tarikh" SortExpression="Tarikh" />
<asp:BoundField DataField="JenisMerit" HeaderText="JenisMerit" SortExpression="JenisMerit" />
<asp:BoundField DataField="MataMerit" HeaderText="MataMerit" SortExpression="MataMerit" />
<asp:BoundField DataField="KeteranganMerit" HeaderText="KeteranganMerit" SortExpression="KeteranganMerit" />
<asp:BoundField DataField="StatusPengMerit" HeaderText="StatusPengMerit" ortExpression="StatusPengMerit" />
<asp:TemplateField HeaderText="Fungsi">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" CommandName="Select" ImageUrl="~/Picture/go_next_blue.png" Width="32px" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
this is my formview code
<asp:FormView ID="FormView2" runat="server" DataKeyNames="IdMerit"
DataSourceID="SqlDataSource3">
<EditItemTemplate>
Tarikh:
<asp:TextBox ID="TarikhTextBox" runat="server" Text='<%# Bind("Tarikh") %>' />
<br />JenisMerit:
<asp:TextBox ID="JenisMeritTextBox" runat="server"Text='<%# Bind("JenisMerit") %>' />
<br />
MataMerit:
<asp:TextBox ID="MataMeritTextBox" runat="server" Text='<%# Bind("MataMerit") %>' />
<br />
KeteranganMerit:
<asp:TextBox ID="KeteranganMeritTextBox" runat="server" Text='<%# Bind("KeteranganMerit") %>' />
<br />
StatusPengMerit:
<asp:TextBox ID="StatusPengMeritTextBox" runat="server" Text='<%# Bind("StatusPengMerit") %>' />
<br />
IdMerit:
<asp:Label ID="IdMeritLabel1" runat="server" Text='<%# Eval("IdMerit") %>' /><br />
IdPelajar:
<asp:TextBox ID="IdPelajarTextBox" runat="server"
Text='<%# Bind("IdPelajar") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
Tarikh:
<asp:TextBox ID="TarikhTextBox" runat="server" Text='<%# Bind("Tarikh") %>' />
<br />
JenisMerit:
<asp:TextBox ID="JenisMeritTextBox" runat="server"
Text='<%# Bind("JenisMerit") %>' />
<br />
MataMerit:
<asp:TextBox ID="MataMeritTextBox" runat="server"
Text='<%# Bind("MataMerit") %>'
<br />KeteranganMerit:
<asp:TextBox ID="KeteranganMeritTextBox" runat="server"
Text='<%# Bind("KeteranganMerit") %>' />
<br />
StatusPengMerit:
<asp:TextBox ID="StatusPengMeritTextBox" runat="server"
Text='<%# Bind("StatusPengMerit") %>' />
<br />
IdPelajar:
<asp:TextBox ID="IdPelajarTextBox" runat="server"
Text='<%# Bind("IdPelajar") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
Tarikh:
<asp:Label ID="TarikhLabel" runat="server" Text='<%# Bind("Tarikh") %>' />
<br />JenisMerit:
<asp:Label ID="JenisMeritLabel" runat="server"
Text='<%# Bind("JenisMerit") %>' />
<br /> MataMerit:
<asp:Label ID="MataMeritLabel" runat="server" Text='<%# Bind("MataMerit") %>' />
<br />KeteranganMerit:
<asp:Label ID="KeteranganMeritLabel" runat="server"
Text='<%# Bind("KeteranganMerit") %>' />
<br />StatusPengMerit:
<asp:Label ID="StatusPengMeritLabel" runat="server"
Text='<%# Bind("StatusPengMerit") %>' />
<br /> IdMerit:
<asp:Label ID="IdMeritLabel" runat="server" Text='<%# Eval("IdMerit") %>' />
<br /> IdPelajar:
<asp:Label ID="IdPelajarLabel" runat="server" Text='<%# Bind("IdPelajar") %>' />
<br />
</ItemTemplate>
</asp:FormView>
hope can get help, no code behind so far
Nakor
Member
336 Points
60 Posts
Re: Display Selected GridView in FormView
Nov 04, 2012 08:10 PM|LINK
if you go into the configuration wizard for the formview's sql datasource one of the screen's should include a "where" button. If you click that it gives you a screen where you can add filter's to your SqlDataSource and one of the options is to use another control to provide the value to use.
If you still have problems then post the code for the SqlDataSource for your FormView
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Display Selected GridView in FormView
Nov 05, 2012 01:02 AM|LINK
Hi,
You should set teh ControlParameter for the FormView to link the GridView together, here's the sample you can download and see:
http://www.codeproject.com/Articles/16780/GridView-FormView-Master-Detail-Control
afastars
Member
52 Points
221 Posts
Re: Display Selected GridView in FormView
Nov 05, 2012 04:43 AM|LINK
hai decker and nakor both of you give me an idea to resolve my isseus..million thank you to both of you....yerterday really tired to look very carefully the confguration..lastly i got the problem .tha datakeyname is wrong now my gridview and formview work fine thanks again to both of you
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Display Selected GridView in FormView
Nov 05, 2012 04:50 AM|LINK
Your problem is solved or not?
Cheers