Solved

Get parameter value from detailsview row

Posted on 2007-04-01
2
444 Views
Last Modified: 2012-08-13
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
Comment
Question by:QPR
2 Comments
 
LVL 15

Accepted Solution

by:
igor_alpha earned 500 total points
Comment Utility
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
 
LVL 29

Author Comment

by:QPR
Comment Utility
perfect!
I really do need to learn what all these attributes mean for the controls!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now