Solved

postback SqlDataSource

Posted on 2009-07-07
3
555 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

690 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