Subject: MM:DataSet mystery
Posted By: bridon123 Post Date: 12/4/2003 4:58:58 PM
Can anyone tell me how to use the Expression attribute of MM:Dataset to stop the CommandText from executing on Page_Load?

My code:
<MM:DataSet
id="dsPermInfo1"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_DeathStarPERMPLUSRead"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_DeathStarPERMPLUSRead"] %>'
CommandText='<%# "SELECT * FROM dbo.v_InspectionHistory WHERE PermitNo = @Year;" %>'
Expression='<%# Page.IsPostBack %>'
Debug="true" PageSize="15">

according to Macromedia, Expression='<%# Page.IsPostBack %>' should stop the Dataset from executing unless the page is postback. However it is still executing on Page_Load. I would like it to execute when a button is pressed.

Anyone know how to do this??

Reply By: stu9820 Reply Date: 12/10/2003 12:56:38 PM
I'm not sure how dreamweaver handles 'Expression'.  But page.isPostBack will either return true or false.

you can use:

If NOT IsPostBack Then
   call the sub here
Else
End If

Please post your code in the page_load sub.

Reply By: Kframbro Reply Date: 1/12/2004 9:44:10 PM
Expression in Dreamweaver datasets is boolean and indicates if the dataset should be executed.  In your example, the expression should be false until the postback.  However...if you have autopostback enable on the page...it could become true unexpectedly.  I would recommend that you change the dateset to:

EXPRESSION="false"

and use the following statement to execute the dataset within your subroutine

DatasetName.Expression="true"

Hope this helps


Go to topic 8421

Return to index page 971
Return to index page 970
Return to index page 969
Return to index page 968
Return to index page 967
Return to index page 966
Return to index page 965
Return to index page 964
Return to index page 963
Return to index page 962