I have a SqlDataSource and am trying to establish if it returns rows using the selected event e.AffectedRows statement. Unfortunately the selected event does not fire.
I am using a stored procedure with 2 parameters:
applicantID - Int32 - Parameter source from control label text
Member
3 Points
40 Posts
SqlDataSource Selecting/Selected events not firing
Nov 21, 2006 05:19 AM|Assimalyst|LINK
Hi,
I have a SqlDataSource and am trying to establish if it returns rows using the selected event e.AffectedRows statement. Unfortunately the selected event does not fire.
I am using a stored procedure with 2 parameters:
applicantID - Int32 - Parameter source from control label text
issueStatus - Int16 - Parameter source 'None' default value = 1
When i test it during configuration it returns 1 row as expected.
I am manually running the DataSource using ds.DataBind(); after a button click.
Anyone know why its not firing the event?
Thanks
Member
3 Points
40 Posts
Re: SqlDataSource Selecting/Selected events not firing
Nov 22, 2006 06:05 AM|Assimalyst|LINK
Solved it. The problem was with DataSource.DataBind().
I needed to 'Select' on the DataSource:
DataSource.Select(DataSourceSelectArguments.Empty);
Hope this helps someone.
None
0 Points
4 Posts
Re: SqlDataSource Selecting/Selected events not firing
Mar 31, 2012 09:01 AM|bhavin011|LINK
try
{
SqlDataSource1.Select(DataSourceSelectArguments.Empty);
SqlDataSource1.DataBind();
}
catch(Exception)
{ }