Solved

Get parameter value from detailsview row

Posted on 2007-04-01
2
451 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…

856 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