• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 457
  • Last Modified:

Get parameter value from detailsview row

I have a detailsview on my aspx page.
The last row is a boundfield that I have set to invisible (I need the value but not to show it).

Next to this I have a gridview. It's datasource is a stored procedure with a single input parameter.
I need this parameter to be the (invisible) value from my detailsview.
I've set the datasource for the gridview and set the parameter to come the control detailsview1 but I can't see a way to specify the actual value/row to feed the gridview with.
0
QPR
Asked:
QPR
1 Solution
 
igor_alphaCommented:
Hi QPR,
Using hidden field in detailsview for parameter passing is not elegant solution.
Better to specify datafield which you hide as DetailssView datakey. You can do it through property pages of DetailView or in aspx. Let say hidden field is "id":
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" DataKeyNames="id">
        </asp:DetailsView>
Now, you can specify DetailsView.SelectedValue as parameter in dataSource. Again you can do it through property pages of dataSource or in aspx:
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server">
            <SelectParameters>
                <asp:ControlParameter ControlID="DetailsView1" Name="newparameter" PropertyName="SelectedValue" />
            </SelectParameters>
        </asp:ObjectDataSource>
0
 
QPRAuthor Commented:
perfect!
I really do need to learn what all these attributes mean for the controls!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now