G
Gerhard
Hi,
I have an application that uses an aps:GridView. The GridView is populated
using a DataSource that calls a StoredProcedure. The DataSource passes
parameters to the StoredProcedure based on some text fields. The page has
been running slower than wanted, so I was doing some checking. I ran SQL
Profiler while loading the page, and saw the StoredProcedure was being called
twice. I stepped through the code and found out that in the Page Load
Complete event was where this was happening. In this event, I set the value
of a parameter for the StoredProcedure, then did a DataBind on the GridView
to pick up the data. As I was stepping through the code, I watched the SQL
Profiler. When I got to the step of setting the parameter, the
StoredProcedure had not yet been called. When I stepped through that and got
to the DataBind command (before runnning that step), the SQL Profiler showed
that the StoredProcedure had been called. Then I did the DataBind and the
StoredProcedure was called again. My question is, how do I get the
parameters set, and get the GridView data bound, and only call the
StoredProcedure once? If I comment out the DataBind step, the
StoredProcedure never does get called (which seems really strange to me...).
Can you help me on this? Thanks.
I have an application that uses an aps:GridView. The GridView is populated
using a DataSource that calls a StoredProcedure. The DataSource passes
parameters to the StoredProcedure based on some text fields. The page has
been running slower than wanted, so I was doing some checking. I ran SQL
Profiler while loading the page, and saw the StoredProcedure was being called
twice. I stepped through the code and found out that in the Page Load
Complete event was where this was happening. In this event, I set the value
of a parameter for the StoredProcedure, then did a DataBind on the GridView
to pick up the data. As I was stepping through the code, I watched the SQL
Profiler. When I got to the step of setting the parameter, the
StoredProcedure had not yet been called. When I stepped through that and got
to the DataBind command (before runnning that step), the SQL Profiler showed
that the StoredProcedure had been called. Then I did the DataBind and the
StoredProcedure was called again. My question is, how do I get the
parameters set, and get the GridView data bound, and only call the
StoredProcedure once? If I comment out the DataBind step, the
StoredProcedure never does get called (which seems really strange to me...).
Can you help me on this? Thanks.