troubleshooting Question

How to use a gridview cell's value as a control parameter

Avatar of C Williams
C WilliamsFlag for United States of America asked on
Visual Basic.NETASP.NET
10 Comments1 Solution426 ViewsLast Modified:
I have an asp.net (VB) web app that has 7 columns.  The 5th column has a seperate DataSource than the rest of the columns.  I want to use the value from the first column as a ControlParamter (or SessionParamter if that works) in the SelectParameter of that column.

Is that Possible?  Attached is partial code of what I've tried for my SelectParameters.
<asp:SqlDataSource ID="neccoLocation" runat="server" ConnectionString="<%$ ConnectionStrings:necco40 %>" SelectCommand="SELECT DISTINCT in_locn_key FROM in_stock_tbl WHERE	gl_cmp_key = 'NE' AND in_whs_key = '12' AND (in_locn_key NOT IN ('warehouse', 'staging', 'shortage')) AND (in_locn_key NOT LIKE 'r%') AND (in_locn_key NOT LIKE 's%') AND (in_locn_key NOT LIKE 'q%') AND (in_locn_key NOT LIKE 'w%') AND (in_locn_key NOT LIKE '3%') AND (in_locn_key NOT LIKE '5%') AND (in_locn_key <> '67ship') AND (in_locn_key NOT LIKE 'area%') AND (in_locn_qoh > '0') AND (in_item_key = '@lblIngred') ">                       
                        <SelectParameters>
                            <asp:ControlParameter ControlID='<%# gvIngredients.FindControl("lblIngred") %>' PropertyName="Text" Name="lblIngred" Type="String" />
                            <asp:SessionParameter Name="lblIngred" SessionField="lblIngred"  />
                        </SelectParameters>
                    </asp:SqlDataSource>
ASKER CERTIFIED SOLUTION
carlnorrbom

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros