Solved

postback SqlDataSource

Posted on 2009-07-07
3
548 Views
Last Modified: 2013-12-17
I am using the following ASP to connect to my database and populate my FormView.

I only want to do this when the page  is  NOT postback. How can I do this?

Here is the asp

 <asp:SqlDataSource ID="PeerAssementDB" runat="server"
        ConnectionString="<%$ ConnectionStrings:ReferralConnectionString %>"
        SelectCommand="spGeteerReviewMonthlyAll" SelectCommandType="StoredProcedure"
        UpdateCommand="spUpdateeerReviewMonthly" UpdateCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList_SpecDescription" Name="Spec_Desc"
                PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="DropDownList_Status" Name="Status"
                PropertyName="SelectedValue" Type="String" />
            <asp:QueryStringParameter DefaultValue="P8" Name="OrgCode"
                QueryStringField="OrgCode" Type="String" />
        </SelectParameters>
0
Comment
Question by:Mr_Shaw
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
muktou earned 500 total points
ID: 24795794
The Sql Datasource should bind at run time. When the page is not postback then you can bind SQL database with the formview in page load event. like

Page_Load()
{
If(Page.IsPostBack)
{
formview1.DataSource = SQLdatasource1;
formview1.Databind();
}

0
 
LVL 1

Expert Comment

by:muktou
ID: 24795805
formview1.DataSource = SQLdatasource1; please igore this statement and use following statement:

formview1.DataSource = "SQLdatasource1";
0
 

Author Closing Comment

by:Mr_Shaw
ID: 31600672
thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question