Solved

postback SqlDataSource

Posted on 2009-07-07
3
543 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
Comment Utility
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
Comment Utility
formview1.DataSource = SQLdatasource1; please igore this statement and use following statement:

formview1.DataSource = "SQLdatasource1";
0
 

Author Closing Comment

by:Mr_Shaw
Comment Utility
thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now