<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Searching database data using parameters with the ASP.NET SqlDataSource and GridView controls</title>
	<link>http://www.csharpuniversity.com/2008/12/31/searching-database-data-using-parameters-with-the-aspnet-sqldatasource-and-gridview-controls/</link>
	<description>Quality ASP.NET/C#/SQL Server tutorials, examples, videos and advice</description>
	<pubDate>Thu, 09 Feb 2012 17:50:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>

	<item>
		<title>By: Sal</title>
		<link>http://www.csharpuniversity.com/2008/12/31/searching-database-data-using-parameters-with-the-aspnet-sqldatasource-and-gridview-controls/#comment-241</link>
		<dc:creator>Sal</dc:creator>
		<pubDate>Mon, 28 Dec 2009 22:57:45 +0000</pubDate>
		<guid>http://www.csharpuniversity.com/2008/12/31/searching-database-data-using-parameters-with-the-aspnet-sqldatasource-and-gridview-controls/#comment-241</guid>
		<description>Cheers Ted, will give that a go. 
Thanks!</description>
		<content:encoded><![CDATA[<p>Cheers Ted, will give that a go.<br />
Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ted</title>
		<link>http://www.csharpuniversity.com/2008/12/31/searching-database-data-using-parameters-with-the-aspnet-sqldatasource-and-gridview-controls/#comment-240</link>
		<dc:creator>ted</dc:creator>
		<pubDate>Mon, 28 Dec 2009 16:50:32 +0000</pubDate>
		<guid>http://www.csharpuniversity.com/2008/12/31/searching-database-data-using-parameters-with-the-aspnet-sqldatasource-and-gridview-controls/#comment-240</guid>
		<description>Sal, to do something like this, I suggest that you put some code in your code behind.  Probably the best place to put it is in the button click event.  Try this code to dynamically change the name of the column you are searching on:

CSharpDataSource.SelectCommand = string.format("Select * FROM Employee WHERE {0} LIKE @filterVal",ddlColSelect.SelectedValue);</description>
		<content:encoded><![CDATA[<p>Sal, to do something like this, I suggest that you put some code in your code behind.  Probably the best place to put it is in the button click event.  Try this code to dynamically change the name of the column you are searching on:</p>
<p>CSharpDataSource.SelectCommand = string.format(&#8221;Select * FROM Employee WHERE {0} LIKE @filterVal&#8221;,ddlColSelect.SelectedValue);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sal</title>
		<link>http://www.csharpuniversity.com/2008/12/31/searching-database-data-using-parameters-with-the-aspnet-sqldatasource-and-gridview-controls/#comment-234</link>
		<dc:creator>Sal</dc:creator>
		<pubDate>Tue, 22 Dec 2009 15:22:15 +0000</pubDate>
		<guid>http://www.csharpuniversity.com/2008/12/31/searching-database-data-using-parameters-with-the-aspnet-sqldatasource-and-gridview-controls/#comment-234</guid>
		<description>Ted, my code seems to have been omitted from my above post, have redone below but without the closing/enclosing brackets (in case they are the cause).

aspDatasource SelectCommand= Select * FROM Employee WHERE @ColVal LIKE @filterVal
Parameters
aspControlParamter Name=ColVal ControlID=ddlColSelect
aspParameter Name=filterVal ControlID=txtFilter
Parameters</description>
		<content:encoded><![CDATA[<p>Ted, my code seems to have been omitted from my above post, have redone below but without the closing/enclosing brackets (in case they are the cause).</p>
<p>aspDatasource SelectCommand= Select * FROM Employee WHERE @ColVal LIKE @filterVal<br />
Parameters<br />
aspControlParamter Name=ColVal ControlID=ddlColSelect<br />
aspParameter Name=filterVal ControlID=txtFilter<br />
Parameters</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sal</title>
		<link>http://www.csharpuniversity.com/2008/12/31/searching-database-data-using-parameters-with-the-aspnet-sqldatasource-and-gridview-controls/#comment-233</link>
		<dc:creator>Sal</dc:creator>
		<pubDate>Tue, 22 Dec 2009 15:15:49 +0000</pubDate>
		<guid>http://www.csharpuniversity.com/2008/12/31/searching-database-data-using-parameters-with-the-aspnet-sqldatasource-and-gridview-controls/#comment-233</guid>
		<description>Ted, firstly excellent articles well done!
A quick query for you regarding the above content - I have a dropdownlist, a text box, and a gridview. The dropdown list contains the gridviews column names. The user selects a column name they wish to filter in the dropdownlist and then as they type in the textbox the gridview's content should filter down accordingly. The issue I am having is that it doesnt seem I can use a paramter for both column name and its value:



    
    


Is there anyway I can enable filtering of a gridview based on a particular column by data entered into a textbox?</description>
		<content:encoded><![CDATA[<p>Ted, firstly excellent articles well done!<br />
A quick query for you regarding the above content - I have a dropdownlist, a text box, and a gridview. The dropdown list contains the gridviews column names. The user selects a column name they wish to filter in the dropdownlist and then as they type in the textbox the gridview&#8217;s content should filter down accordingly. The issue I am having is that it doesnt seem I can use a paramter for both column name and its value:</p>
<p>Is there anyway I can enable filtering of a gridview based on a particular column by data entered into a textbox?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

