Solved

Get parameter value from detailsview row

Posted on 2007-04-01
2
449 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
ID: 18834323
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
ID: 18834394
perfect!
I really do need to learn what all these attributes mean for the controls!
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

810 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