Is it possible to programmatically access items in sqldatasource once they are loaded? Context: sqldatasource is binded to list of checkboxes. When submitted, I have id of selected item, but I also need other information. So if I could acces loaded items in SqlDataSource that would suffice.

i know this is not very clear, I'm new to asp.net and it's so counter-intuituve.

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

As long as the sqlDataSource has been setup to Cache the data (DataSourceMode="DataSet" EnableCaching="True") (See Caching Data with the SqlDataSource Control) then you can select cached items using the sqlDataSource in code like so:

DataView dataView = (DataView)sqlDataSource.Select(new DataSourceSelectArguments());
DataTable dataTable = dataView.ToTable();

The DataSourceSelectArguments class provides a means to specify the SortExpression amongst other things.

Hope this helps.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.