1

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.