C# Question about query results

Here is the code.  This question is specifically about the SQL portion of the code:
<%@ Page Title="" Language="C#" MasterPageFile="~main.master" %>
 <script runat="server">

protected void btnAdd_Click(object sender, EventArgs e)
{
    sqlBooks.Insert();
    txtNewBook.Text = String.Empty;
    gvBooks.DataBind();
}
 </script>
 <asp:Content ID="Content2" ContentPlaceHolderID="cphMain" Runat="Server">
 <div id="awindow" >
<asp:Panel ID="Panel1" runat="server" CssClass="mainContent">
<div style="width: 100%; float: left">    
    <asp:Image ID="Image1" runat="server" ImageUrl=" "  Width="100%"/>
    <asp:TextBox runat="server"  style="margin-left:5px; float:left;" ID="txtNewTitle" />
    <asp:ImageButton runat="server" ID="btnAddTitle" Height="17px" ToolTip="Add New Book"      ImageUrl="~insert.png" OnClick="btnAd_Click"/>
</div>
<asp:SqlDataSource runat="server" ID="sqlBookLibs" ConnectionString="<%$   ConnectionStrings:dbbooks %>" ProviderName="<%$ ConnectionStrings:AllBooks.ProviderName %>" 
    SelectCommand="SELECT * FROM BookTitles ORDER BY Titles" 
    InsertCommand="BookTitles_GetOrCreate" InsertCommandType="StoredProcedure">
    <InsertParameters>
        <asp:ControlParameter ControlID="txtNewTitle" Name="titlename" />
    </InsertParameters>
</asp:SqlDataSource>

    <asp:GridView runat="server" ID="gvBooks" DataSourceID="sqlBookTitles" DataKeyNames="BookTitles" AutoGenerateColumns="false">
        <Columns>
            <asp:HyperLinkField HeaderText="Book Name"  DataNavigateUrlFormatString="~/BookTitles/Books.aspx?id={0}" DataNavigateUrlFields="PartnerID" DataTextField="BookName" />
        </Columns>
        <Columns>
             <asp:HyperLinkField HeaderText="Find Book Titles"  DataNavigateUrlFields="" DataTextField="" />

        </Columns>
    </asp:GridView>
</asp:Panel>
</div>
</asp:Content>

Open in new window


My question is- shouldn't I be able to use the result of the above SQL query in other text boxes, drop down boxes, and text areas I include on this page without re-running the query?  

If so, wouldn't I do that by just referencing the ID in the textbox or text area?  

(Ex:  <input type="text" name="New Title" ID="SQLBookLibs"/>
programmherAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

guru_samiCommented:
1: You can try calling the SqlDataSource.Select manually and store the return values in a local datatable: http://stackoverflow.com/questions/9452763/convert-sqldatasource-to-datatable-and-dataview
Or
2: Do not use SqlDataSource and manually call Select and Insert using sqlCommand:
http://csharp-station.com/Tutorial/AdoDotNet/Lesson03
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
programmherAuthor Commented:
Thank you Guru_Sami.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.