Dynamic connection stringshttp://forums.asp.net/t/1072016.aspx/1?Dynamic+connection+stringsSat, 20 Dec 2008 19:38:19 -050010720161565861http://forums.asp.net/p/1072016/1565861.aspx/1?Dynamic+connection+stringsDynamic connection strings <b><font size="2"> <p>Dynamic connection strings</p> </b> <p>I have found lots of people asking for something similar to this but cannot find any solutions - can you help?</p> <p>I am developing an application (ASP.Net2) in which users are associated with 'Clients' and every Client has their own SQL Server database.</p> <p>Users are authenticated using standard ASP.Net Authentication via a separate database (common for all users). This includes a table linking them to a Client and each Client record includes the connection string to their database. Currently a default connection string is held in the web.config file.</p> <p>My problem is that I don't know how to dynamically change the connection string after a user has logged on. I have a large number of databound controls, many of which are declared and some are coded in the VB.Net code behind. I know I can use code behind to change the connection string for a SQLDatatSource:</p> <p>I thought I had it cracked with the following:</p> </font><font color="#0000ff" size="2"> <p>Public</font><font size="2"> objClientConnection </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">New</font><font size="2"> ConnectionStringSettings</p> </font><font color="#0000ff" size="2"> <p>Public</font><font size="2"> </font><font color="#0000ff" size="2">Sub</font><font size="2"> Page_Init(</font><font color="#0000ff" size="2">ByVal</font><font size="2"> sender </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Object</font><font size="2">, </font><font color="#0000ff" size="2">ByVal</font><font size="2"> e </font><font color="#0000ff" size="2">As</font><font size="2"> System.EventArgs)<br> </font><font color="#0000ff" size="2">If</font><font size="2"> Session(</font><font color="#800000" size="2">&quot;ClientDBConnectionString&quot;</font><font size="2">) &lt;&gt; </font><font color="#800000" size="2">&quot;&quot;</font><font size="2"> </font><font color="#0000ff" size="2">Then<br> </font><font size="2">objClientConnection.ConnectionString = Session(</font><font color="#800000" size="2">&quot;ClientDBConnectionString&quot;</font><font size="2">)<br> objClientConnection.Name = </font><font color="#800000" size="2">&quot;ClientDBConnection&quot;<br> </font><font size="2">objClientConnection.ProviderName = </font><font color="#800000" size="2">&quot;System.Data.SqlClient&quot;<br> </font><font color="#0000ff" size="2">Else<br> </font><font size="2">objClientConnection = ConfigurationManager.ConnectionStrings(</font><font color="#800000" size="2">&quot;WebTool1ConnectionString&quot;</font><font size="2">)<br> </font><font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">If<br> End Sub</p> <p>The session variable Session(&quot;ClientDBConnectionString&quot;) holds the client specific connection string and is populated when the user logs on. If this is not populated then the connection string defaults to one collected from web.config. This should ensure there is always a design time connection string available.</p> <p>The trouble is, when I try and declare the SQL data souce like this:</p> <p>&lt;</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">SqlDataSource</font><font size="2"> </font><font color="#ff0000" size="2">ID</font><font color="#0000ff" size="2">=&quot;dsTest&quot;</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=&quot;server&quot;</font><font size="2"> </font><font color="#ff0000" size="2">ConnectionString</font><font color="#0000ff" size="2">=&quot;</font><font size="2">&lt;%# objClientConnection.ConnectionString %&gt;</font><font color="#0000ff" size="2">&quot; </font><font color="#ff0000" size="2">SelectCommand</font><font color="#0000ff" size="2">=&quot;usp_SEL_DocumentTypes&quot;</font><font size="2"> </font><font color="#ff0000" size="2">SelectCommandType</font><font color="#0000ff" size="2">=&quot;StoredProcedure&quot;</font><font size="2"> </font><font color="#0000ff" size="2">&gt;&lt;/</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">SqlDataSource</font><font color="#0000ff" size="2">&gt;</p> <p>I get an error: <i>The ConnectionString property has not been initialized.</p> </i> <p>I have been going around in circles on this for days and would really appreciate some help. Am I on the right lines? What needs to change to make it work? Is there a better way?</p> <p>Many thanks,</p> <p>Cliff</p> </font> 2007-02-06T14:06:36-05:001569079http://forums.asp.net/p/1072016/1569079.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Hi,</p> <p>If your connection string is created dynamically at run time. We cannot set the connection string at design time. Binding to the property might not work since this depends on when you call DataBind on your controls.</p> <p>In this case, it's better to set this in code behind event handler for Page_Load like</p> <p>Me.dsTest.ConnectionString = objClientConnection.ConnectionString</p> <p>Then you can call DataBind() manually.</p> <p>HTH.<br> </p> 2007-02-08T05:24:53-05:001569325http://forums.asp.net/p/1072016/1569325.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Hi Kevin,</p> <p>Thanks for your response. I think what you are saying is that the only way to set the connection strings dynamically at run time is to use code behind? The problem with this is that the site I am working on has a lot of interrelated, databound controls many of which are coded declaratively. I would have to recode every one of these (and there are hundreds!) in code behind and many are inside other controls (wizards, gridview, etc) and so are complicated to get at in code behind. </p> <p>Given that every one of these databound controls uses: </p> <p>ConnectionString=&lt;%&#36; ConnectionStrings:WebTool1ConnectionString %&gt;</p> <p>I would have thought there would be a way to either:&nbsp; </p> <p>1. dynamically change what connection string this declaration&nbsp;points to, or</p> <p>2. change this to ConnectionString = &lt;% some variable %&gt; where 'some variable' is set to the required connection string in code behind.<br> </p> <p>Is this not possible? </p> <p>Many thanks for you help, </p> <p>Cliff</p> 2007-02-08T08:12:05-05:001571251http://forums.asp.net/p/1072016/1571251.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Hi Cliff,</p> <p>Could you let me see the code that you're calling DataBind on the page? Because whether this is possible depends on when data is being pulled from the server.</p> <p>Thanks!</p> 2007-02-09T08:27:02-05:001571401http://forums.asp.net/p/1072016/1571401.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Hi Kevin,</p> <p>&nbsp;Sorry but I don't have permissions to upload files so will have to cut and paste the code,&nbsp; see below. This is a typical example of one of the pages on this site. Some are more complex with cascading DropDownLists within Panels within Wizard controls, etc.</p> <p>&nbsp;Cliff&nbsp; </p> <p>Source code:<pre class="prettyprint">&lt;%@ Page Language=&quot;VB&quot; MasterPageFile=&quot;~/Client.master&quot; Trace=&quot;False&quot; Theme=&quot;DataLabClient1&quot;%&gt; &lt;%@ Import Namespace=&quot;System.Data&quot; %&gt; &lt;%@ Import Namespace=&quot;System.Data.SqlClient&quot; %&gt; &lt;script runat=&quot;server&quot;&gt; Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Master.Page.Title = &quot;Datalab - Manage Reports&quot; End Sub Protected Sub cbReportType_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbReportType.Checked Then pnlReportType.Visible = True Else pnlReportType.Visible = False End If End Sub Protected Sub rblReportSource_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) 'If Not Page.IsPostBack Then ddlReportSource.Items.Clear() ddlReportSource.AppendDataBoundItems = True ddlReportSource.Items.Add(New ListItem(&quot;Any&quot;, &quot;Any&quot;)) 'End If If rblReportSource.SelectedValue = &quot;standard&quot; Then ddlReportSource.Visible = True Else ddlReportSource.Visible = False End If GridView1.DataBind() End Sub Protected Sub cbFirstFileDate_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbFirstFileDate.Checked Then ddlFirstFileDate.Visible = True Else ddlFirstFileDate.Visible = False End If End Sub Protected Sub cbProductOffer_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbProductOffer.Checked Then pnlProductOffer.Visible = True Else pnlProductOffer.Visible = False End If End Sub Protected Sub cbOfferType_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbOfferType.Checked Then ddlOfferType.Visible = True Else ddlOfferType.Visible = False End If End Sub Protected Sub cbRouteType_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbRouteType.Checked Then ddlRouteType.Visible = True Else ddlRouteType.Visible = False End If End Sub Protected Sub cbProductType_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbProductType.Checked Then ddlProductType.Visible = True Else ddlProductType.Visible = False End If End Sub Protected Sub cbEligibleFor_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbEligibleFor.Checked Then pnlEligibleFor.Visible = True Else pnlEligibleFor.Visible = False End If End Sub Protected Sub cbHolds_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbHolds.Checked Then pnlHolds.Visible = True Else pnlHolds.Visible = False End If End Sub Protected Sub cbEFProductType_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbEFProductType.Checked Then ddlEFProductType.Visible = True Else ddlEFProductType.Visible = False End If End Sub Protected Sub cbEFProductName_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbEFProductName.Checked Then ddlEFProductName.Visible = True Else ddlEFProductName.Visible = False End If End Sub Protected Sub cbEFOfferType_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbEFOfferType.Checked Then ddlEFOfferType.Visible = True Else ddlEFOfferType.Visible = False End If End Sub Protected Sub cbEFContactType_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbEFContactType.Checked Then ddlEFContactType.Visible = True Else ddlEFContactType.Visible = False End If End Sub Protected Sub cbHProductType_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbHProductType.Checked Then ddlHProductType.Visible = True Else ddlHProductType.Visible = False End If End Sub Protected Sub cbHProductName_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbHProductName.Checked Then ddlHProductName.Visible = True Else ddlHProductName.Visible = False End If End Sub Protected Sub cbPopulation_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbPopulation.Checked Then pnlPopulation.Visible = True Else pnlPopulation.Visible = False End If End Sub Protected Sub cbCustomerType_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbCustomerType.Checked Then ddlCustomerType.Visible = True Else ddlCustomerType.Visible = False End If End Sub Protected Sub cbSubPopulation_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbSubPopulation.Checked Then pnlSubPopulation.Visible = True Else pnlSubPopulation.Visible = False End If End Sub Protected Sub cbSelectionGroup_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbSelectionGroup.Checked Then pnlSelectionGroup.Visible = True Else pnlSelectionGroup.Visible = False End If End Sub Protected Sub cbTestPack_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbTestPack.Checked Then pnlTestPack.Visible = True Else pnlTestPack.Visible = False End If End Sub Protected Sub cbCreatedBy_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbCreatedBy.Checked Then pnlCreatedBy.Visible = True Else pnlCreatedBy.Visible = False End If End Sub Protected Sub cbTest_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbTest.Checked Then pnlTest.Visible = True Else pnlTest.Visible = False End If End Sub Protected Sub cbPack_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) If cbPack.Checked Then ddlPack.Visible = True Else ddlPack.Visible = False End If End Sub Protected Sub ddlFileType_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) ddlReportSource.Items.Clear() ddlReportSource.AppendDataBoundItems = True ddlReportSource.Items.Add(New ListItem(&quot;Any&quot;, &quot;Any&quot;)) GridView1.DataBind() End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) If Not Page.IsPostBack Then 'ddlReportSource.Items.Clear() 'ddlReportSource.AppendDataBoundItems = True 'ddlReportSource.Items.Add(New ListItem(&quot;Any&quot;, &quot;Any&quot;)) End If End Sub Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If (e.Row.RowType = DataControlRowType.DataRow) Then Dim row As DataRowView = CType(e.Row.DataItem, DataRowView) If (Not row Is Nothing) Then 'Dim reportType As String = LCase(Trim(CType(row(&quot;report_category&quot;), String))) ' Select Case LCase(Trim(rblReportSource.SelectedValue)) Case &quot;adhoc&quot; ' Display all command buttons Dim convertButton As ButtonField = GridView1.Columns(3) convertButton.Visible = True Dim renameButton As CommandField = GridView1.Columns(4) renameButton.Visible = True Case &quot;standard&quot; ' Just display the View and Delete buttons Dim convertButton As ButtonField = GridView1.Columns(3) convertButton.Visible = False Dim renameButton As CommandField = GridView1.Columns(4) renameButton.Visible = False Case &quot;both&quot; ' Display all command buttons Dim convertButton As ButtonField = GridView1.Columns(3) convertButton.Visible = False Dim renameButton As CommandField = GridView1.Columns(4) renameButton.Visible = False Case Else End Select End If End If End Sub Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) ' Dim row As GridViewRow = GridView1.SelectedRow 'Response.Write(&quot;process gridview row = &quot; &amp; row.Cells(7).Text) 'Dim DropDownList1 As New DropDownList 'Dim ddl As DropDownList = row.FindControl(&quot;DropDownList1&quot;) 'Response.Write(&quot;&lt;br /&gt;process gridview row = &quot; &amp; ddl.SelectedItem.ToString) 'Response.End() End Sub 'Protected Sub dsReportList1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles dsReportList.Deleting ' For x As Integer = 0 To e.Command.Parameters.Count - 1 'Trace.Write(e.Command.Parameters(x).ParameterName) 'Trace.Write(e.Command.Parameters(x).Value) 'Next 'End Sub Protected Sub GridView1_RowDeleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeletedEventArgs) If (Not IsDBNull(e.Exception)) Then Me.lblErrorMessage.Text = e.Exception.Message e.ExceptionHandled = True End If End Sub Protected Sub dsReportList_Deleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) If (e.Exception IsNot Nothing) Then Me.lblErrorMessage.Text = e.Exception.Message e.ExceptionHandled = True Else Me.lblErrorMessage.Text = &quot;Report successfully deleted.&quot; End If End Sub Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs) ' The GridViewCommandEventArgs class does not contain a ' property that indicates which row's command button was ' clicked. To identify which row's button was clicked, use ' the button's CommandArgument property by setting it to the ' row's index. If e.Row.RowType = DataControlRowType.DataRow Then ' Retrieve the Button control from the first column. Dim delButton As Button = CType(e.Row.Cells(2).Controls(0), Button) ' Set the Button's CommandArgument property with the ' row's index. delButton.CommandArgument = e.Row.RowIndex.ToString() delButton.Attributes.Add(&quot;onclick&quot;, &quot;if(confirm('Are you sure you want to permanently delete this report? \nIf not, click Cancel.')){}else{return false}&quot;) ' Now repeat for the View button Dim viewButton As Button = CType(e.Row.Cells(1).Controls(0), Button) ' Set the Button's CommandArgument property with the ' row's index. viewButton.CommandArgument = e.Row.RowIndex.ToString() 'viewButton.Attributes.Add(&quot;onclick&quot;, &quot;if(confirm('Are you sure you want to permanently delete this report? \nIf not, click Cancel.')){}else{return false}&quot;) ' Repeat for the Convert adhoc to standard report button Dim convertButton As Button = CType(e.Row.Cells(3).Controls(0), Button) ' Set the Button's CommandArgument property with the ' row's index. convertButton.CommandArgument = e.Row.RowIndex.ToString() End If End Sub Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) If e.CommandName = &quot;Delete_Report&quot; Then Me.lblErrorMessage.Text = &quot;&quot; Me.lblErrorMessage.Visible = False ' Convert the row index stored in the CommandArgument ' property to an Integer. Dim index As Integer = Convert.ToInt32(e.CommandArgument) ' Retrieve the row that contains the button clicked ' by the user from the Rows collection. Dim row As GridViewRow = GridView1.Rows(index) Dim lblReportName As Label = CType(row.FindControl(&quot;reportname&quot;), Label) Dim reportName As String = lblReportName.Text Dim reportCategory As String = row.Cells(4).Text ' Delete the specified report Dim clientDBConnection As New SqlConnection() clientDBConnection.ConnectionString = Session(&quot;ClientDBConnectionString&quot;) Try Using reportDeleteCommand As SqlCommand = clientDBConnection.CreateCommand() reportDeleteCommand.CommandText = &quot;usp_DEL_Report&quot; reportDeleteCommand.CommandType = Data.CommandType.StoredProcedure reportDeleteCommand.Parameters.AddWithValue(&quot;@report_name&quot;, reportName) reportDeleteCommand.Parameters.AddWithValue(&quot;@report_category&quot;, reportCategory) reportDeleteCommand.Connection.Open() reportDeleteCommand.ExecuteNonQuery() End Using Me.lblErrorMessage.Text = &quot;Report successfully deleted.&quot; Me.lblErrorMessage.Visible = True Catch ex As Exception If (ex IsNot Nothing) Then Me.lblErrorMessage.Text = ex.Message Me.lblErrorMessage.Visible = True ExceptionHandled = True Else Me.lblErrorMessage.Text = &quot;Report successfully deleted.&quot; Me.lblErrorMessage.Visible = True End If End Try clientDBConnection.Dispose() ElseIf e.CommandName = &quot;View_Report&quot; Then ' Convert the row index stored in the CommandArgument ' property to an Integer. Dim index As Integer = Convert.ToInt32(e.CommandArgument) ' Retrieve the row that contains the button clicked ' by the user from the Rows collection. Dim row As GridViewRow = GridView1.Rows(index) Dim lblReportName As Label = CType(row.FindControl(&quot;reportname&quot;), Label) Dim reportName As String = lblReportName.Text Dim lblReportCategory As Label = CType(row.FindControl(&quot;reportCategory&quot;), Label) Dim reportCategory As String = LCase(lblReportCategory.Text) Response.Redirect(&quot;~/Main/Table_Manager/Reports_View.aspx?rept=&quot; &amp; reportName &amp; &quot;&amp;cat=&quot; &amp; reportCategory) ElseIf e.CommandName = &quot;Convert_Report&quot; Then ' Convert the row index stored in the CommandArgument ' property to an Integer. Dim index As Integer = Convert.ToInt32(e.CommandArgument) ' Retrieve the row that contains the button clicked ' by the user from the Rows collection. Dim row As GridViewRow = GridView1.Rows(index) ' Get the report name ... Dim lblReportName As Label = CType(row.FindControl(&quot;reportname&quot;), Label) Dim reportName As String = lblReportName.Text ' ... and get the report title Dim reportTitle As String = row.Cells(10).Text 'Response.Write(&quot;convert report!! &quot; &amp; reportName) 'Response.Write(&quot;&lt;br /&gt;Reeport title = &quot; &amp; reportTitle) 'Response.Write(&quot;&lt;br /&gt;DB Login = &quot; &amp; Session(&quot;client_DatabaseLogon&quot;)) 'Response.Write(&quot;&lt;br /&gt; User = &quot; &amp; Session(&quot;User_LongName&quot;)) 'Response.End() ' Now, convert the report from adhoc to standard Dim clientDBConnection As New SqlConnection() clientDBConnection.ConnectionString = Session(&quot;ClientDBConnectionString&quot;) Try Using reportConvertCommand As SqlCommand = clientDBConnection.CreateCommand() reportConvertCommand.CommandText = &quot;usp_UPD_AdHoc2Standard&quot; reportConvertCommand.CommandType = Data.CommandType.StoredProcedure reportConvertCommand.Parameters.AddWithValue(&quot;@report_name&quot;, reportName) reportConvertCommand.Parameters.AddWithValue(&quot;@report_title&quot;, reportTitle) reportConvertCommand.Parameters.AddWithValue(&quot;@logonid &quot;, Session(&quot;client_DatabaseLogon&quot;)) reportConvertCommand.Parameters.AddWithValue(&quot;@user_LongName&quot;, Session(&quot;User_LongName&quot;)) reportConvertCommand.Connection.Open() reportConvertCommand.ExecuteNonQuery() End Using Me.lblErrorMessage.Text = &quot;Report successfully converted to 'standard'.&quot; Me.lblErrorMessage.Visible = True Catch ex As Exception If (ex IsNot Nothing) Then Me.lblErrorMessage.Text = ex.Message Me.lblErrorMessage.Visible = True ExceptionHandled = True Else Me.lblErrorMessage.Text = &quot;Report conversion status uncertain!&quot; Me.lblErrorMessage.Visible = True End If End Try clientDBConnection.Dispose() End If GridView1.DataBind() End Sub &lt;/script&gt; &lt;asp:Content ID=&quot;Content1&quot; ContentPlaceHolderID=&quot;PageHeader&quot; Runat=&quot;Server&quot;&gt; &lt;h1 style=&quot;text-align: center&quot;&gt; Manage Reports&lt;/h1&gt; &lt;/asp:Content&gt; &lt;asp:Content ID=&quot;Content2&quot; ContentPlaceHolderID=&quot;Body&quot; Runat=&quot;Server&quot;&gt; &lt;br /&gt; &lt;h2&gt; &amp;nbsp;&lt;/h2&gt; &lt;table summary=&quot;Report filters table&quot; frame=&quot;box&quot;&gt; &lt;h1 style=&quot;text-align: left&quot;&gt; Report list filters&lt;/h1&gt; &lt;tr&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 268px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbFile&quot; runat=&quot;server&quot; Checked=&quot;True&quot; Enabled=&quot;False&quot; Width=&quot;20px&quot; Text=&quot;File&quot; /&gt;&lt;/td&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 234px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbReportSource&quot; runat=&quot;server&quot; Checked=&quot;True&quot; Enabled=&quot;False&quot; Text=&quot;Report Source&quot; /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 268px&quot;&gt; &lt;asp:Panel ID=&quot;pnlFileType&quot; runat=&quot;server&quot; Height=&quot;50px&quot;&gt; &lt;table width=&quot;100%&quot;&gt; &lt;tr&gt; &lt;td &gt; &lt;asp:CheckBox ID=&quot;cbFileType&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; Text=&quot;File type&quot; Checked=&quot;True&quot; Enabled=&quot;False&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px; height: 55px;&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlFileType&quot; runat=&quot;server&quot; AppendDataBoundItems=&quot;True&quot; AutoPostBack=&quot;True&quot; DataSourceID=&quot;dsFileType&quot; DataTextField=&quot;file_type&quot; DataValueField=&quot;file_type_extended&quot; OnSelectedIndexChanged=&quot;ddlFileType_SelectedIndexChanged&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsFileType&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_FileTypes&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbFirstFileDate&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; Text=&quot;First file date&quot; OnCheckedChanged=&quot;cbFirstFileDate_CheckedChanged&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlFirstFileDate&quot; runat=&quot;server&quot; Visible=&quot;False&quot; DataSourceID=&quot;dsFirstFileDate&quot; DataTextField=&quot;first_file_date&quot; DataValueField=&quot;first_file_date&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsFirstFileDate&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_FirstFileDate&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 234px&quot;&gt; &lt;asp:Panel ID=&quot;pnlReportSource&quot; runat=&quot;server&quot; Height=&quot;50px&quot; Width=&quot;125px&quot;&gt; &lt;table&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:RadioButtonList ID=&quot;rblReportSource&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; OnSelectedIndexChanged=&quot;rblReportSource_SelectedIndexChanged&quot; &gt; &lt;asp:ListItem Value=&quot;adhoc&quot;&gt;Ad Hoc&lt;/asp:ListItem&gt; &lt;asp:ListItem Value=&quot;standard&quot; Selected=&quot;True&quot;&gt;Standard&lt;/asp:ListItem&gt; &lt;asp:ListItem Value=&quot;both&quot;&gt;Both&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlReportSource&quot; runat=&quot;server&quot; DataSourceID=&quot;dsStandardReports&quot; DataTextField=&quot;standard_name&quot; DataValueField=&quot;standard_name&quot; AppendDataBoundItems=&quot;True&quot; AutoPostBack=&quot;True&quot; &gt; &lt;asp:ListItem Selected=&quot;True&quot;&gt;Any&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsStandardReports&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_StandardReports&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt; &lt;SelectParameters&gt; &lt;asp:ControlParameter ControlID=&quot;cbReportType&quot; DefaultValue=&quot;False&quot; Name=&quot;report_type_checked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlReportType&quot; DefaultValue=&quot;Null&quot; Name=&quot;report_type&quot; PropertyName=&quot;SelectedValue&quot; Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbFileType&quot; DefaultValue=&quot;False&quot; Name=&quot;file_type_checked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlFileType&quot; DefaultValue=&quot;Null&quot; Name=&quot;file_type&quot; PropertyName=&quot;SelectedItem.Text&quot; Type=&quot;String&quot; /&gt; &lt;asp:Parameter DefaultValue=&quot;False&quot; Name=&quot;route_type_checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:Parameter Name=&quot;route_type&quot; Type=&quot;String&quot; DefaultValue=&quot;Null&quot; /&gt; &lt;asp:Parameter DefaultValue=&quot;False&quot; Name=&quot;product_type_checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:Parameter Name=&quot;product_type&quot; Type=&quot;String&quot; DefaultValue=&quot;Null&quot; /&gt; &lt;asp:Parameter DefaultValue=&quot;False&quot; Name=&quot;offer_type_checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:Parameter Name=&quot;offer_type&quot; Type=&quot;String&quot; DefaultValue=&quot;Null&quot; /&gt; &lt;/SelectParameters&gt; &lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 268px&quot;&gt; &lt;br /&gt; &lt;asp:CheckBox ID=&quot;cbReportType&quot; runat=&quot;server&quot; OnCheckedChanged=&quot;cbReportType_CheckedChanged&quot; AutoPostBack=&quot;True&quot; Text=&quot;Report type&quot; /&gt;&lt;asp:Panel ID=&quot;pnlReportType&quot; runat=&quot;server&quot; Height=&quot;50px&quot; Width=&quot;125px&quot; Visible=&quot;False&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlReportType&quot; runat=&quot;server&quot; DataSourceID=&quot;dsReportType&quot; DataTextField=&quot;report_type&quot; DataValueField=&quot;report_type&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsReportType&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_ReportTypes4FileType&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt; &lt;SelectParameters&gt; &lt;asp:ControlParameter ControlID=&quot;ddlFileType&quot; Name=&quot;file_type&quot; PropertyName=&quot;SelectedItem.Text&quot; Type=&quot;String&quot; DefaultValue=&quot;Any&quot; /&gt; &lt;/SelectParameters&gt; &lt;/asp:SqlDataSource&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 234px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbProductOffer&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; OnCheckedChanged=&quot;cbProductOffer_CheckedChanged&quot; Text=&quot;Product offer&quot; /&gt;&lt;br /&gt; &lt;asp:Panel ID=&quot;pnlProductOffer&quot; runat=&quot;server&quot; Height=&quot;50px&quot; Visible=&quot;False&quot;&gt; &lt;table&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbOfferType&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; OnCheckedChanged=&quot;cbOfferType_CheckedChanged&quot; Text=&quot;Offer type&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlOfferType&quot; runat=&quot;server&quot; Visible=&quot;False&quot; DataSourceID=&quot;dsOfferTypes&quot; DataTextField=&quot;offer_type&quot; DataValueField=&quot;offer_type_short&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsOfferTypes&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_OfferTypes&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbRouteType&quot; runat=&quot;server&quot; OnCheckedChanged=&quot;cbRouteType_CheckedChanged&quot; Text=&quot;Route type&quot; AutoPostBack=&quot;True&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlRouteType&quot; runat=&quot;server&quot; Visible=&quot;False&quot; DataSourceID=&quot;dsRouteTypes&quot; DataTextField=&quot;route_type&quot; DataValueField=&quot;route_type_short&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsRouteTypes&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_RouteTypes&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbProductType&quot; runat=&quot;server&quot; Text=&quot;Product type&quot; OnCheckedChanged=&quot;cbProductType_CheckedChanged&quot; AutoPostBack=&quot;True&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlProductType&quot; runat=&quot;server&quot; Visible=&quot;False&quot; DataSourceID=&quot;dsProductTypes&quot; DataTextField=&quot;product_type&quot; DataValueField=&quot;product_type_short&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsProductTypes&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_ProductTypes&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 268px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbEligibleFor&quot; runat=&quot;server&quot; OnCheckedChanged=&quot;cbEligibleFor_CheckedChanged&quot; Text=&quot;Eligible for&quot; AutoPostBack=&quot;True&quot; /&gt;&lt;br /&gt; &lt;asp:Panel ID=&quot;pnlEligibleFor&quot; runat=&quot;server&quot; Height=&quot;50px&quot; Visible=&quot;False&quot;&gt; &lt;table&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px; height: 29px;&quot;&gt; &lt;asp:CheckBox ID=&quot;cbEFProductType&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; Text=&quot;Product type&quot; OnCheckedChanged=&quot;cbEFProductType_CheckedChanged&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px; height: 29px;&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlEFProductType&quot; runat=&quot;server&quot; Visible=&quot;False&quot; DataSourceID=&quot;dsEFProductTypes&quot; DataTextField=&quot;product_type&quot; DataValueField=&quot;product_type_short&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsEFProductTypes&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_ProductTypes&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbEFProductName&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; Text=&quot;Product name&quot; OnCheckedChanged=&quot;cbEFProductName_CheckedChanged&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlEFProductName&quot; runat=&quot;server&quot; Visible=&quot;False&quot; DataSourceID=&quot;dsEPProductNames&quot; DataTextField=&quot;product_name&quot; DataValueField=&quot;product_name&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsEPProductNames&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;up_SEL_ProductNames&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbEFOfferType&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; Text=&quot;Offer type&quot; OnCheckedChanged=&quot;cbEFOfferType_CheckedChanged&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlEFOfferType&quot; runat=&quot;server&quot; Visible=&quot;False&quot; DataSourceID=&quot;dsEFOfferType&quot; DataTextField=&quot;offer_type&quot; DataValueField=&quot;offer_type_short&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsEFOfferType&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_OfferTypes&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px; height: 29px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbEFContactType&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; Text=&quot;Contact type&quot; OnCheckedChanged=&quot;cbEFContactType_CheckedChanged&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px; height: 29px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlEFContactType&quot; runat=&quot;server&quot; Visible=&quot;False&quot; DataSourceID=&quot;dsEFContactTypes&quot; DataTextField=&quot;contact_type&quot; DataValueField=&quot;contact_type&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsEFContactTypes&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_ContactTypes&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 234px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbHolds&quot; runat=&quot;server&quot; Text=&quot;Holds&quot; OnCheckedChanged=&quot;cbHolds_CheckedChanged&quot; AutoPostBack=&quot;True&quot; /&gt;&lt;br /&gt; &lt;asp:Panel ID=&quot;pnlHolds&quot; runat=&quot;server&quot; Height=&quot;50px&quot; Visible=&quot;False&quot;&gt; &lt;table&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbHProductType&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; Text=&quot;Product type&quot; OnCheckedChanged=&quot;cbHProductType_CheckedChanged&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlHProductType&quot; runat=&quot;server&quot; Visible=&quot;False&quot; DataSourceID=&quot;dsHProductType&quot; DataTextField=&quot;product_type&quot; DataValueField=&quot;product_type&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsHProductType&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_ProductTypes&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbHProductName&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; Text=&quot;Product name&quot; OnCheckedChanged=&quot;cbHProductName_CheckedChanged&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlHProductName&quot; runat=&quot;server&quot; Visible=&quot;False&quot; DataSourceID=&quot;dsHProductName&quot; DataTextField=&quot;product_name&quot; DataValueField=&quot;product_name&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsHProductName&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_ProductNames&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=&quot;4&quot;&gt; &lt;asp:CheckBox ID=&quot;cbPopulation&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; Text=&quot;Population&quot; OnCheckedChanged=&quot;cbPopulation_CheckedChanged&quot; /&gt; &lt;asp:Panel ID=&quot;pnlPopulation&quot; runat=&quot;server&quot; Height=&quot;50px&quot; Visible=&quot;False&quot;&gt; &lt;table&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbCustomerType&quot; runat=&quot;server&quot; OnCheckedChanged=&quot;cbCustomerType_CheckedChanged&quot; AutoPostBack=&quot;True&quot; Text=&quot;Customer type&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlCustomerType&quot; runat=&quot;server&quot; DataSourceID=&quot;dsPopCustomerTypes&quot; DataTextField=&quot;customer_type&quot; DataValueField=&quot;customer_type&quot; Visible=&quot;False&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsPopCustomerTypes&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_CustomerTypes&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbSubPopulation&quot; runat=&quot;server&quot; OnCheckedChanged=&quot;cbSubPopulation_CheckedChanged&quot; AutoPostBack=&quot;True&quot; Text=&quot;Sub-population&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:Panel ID=&quot;pnlSubPopulation&quot; runat=&quot;server&quot; Height=&quot;50px&quot; Visible=&quot;False&quot;&gt; &lt;table&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; Sub&amp;#8209population&amp;nbsp;field&amp;nbsp;filter&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlsubPopulationFieldFilter&quot; runat=&quot;server&quot; AppendDataBoundItems=&quot;True&quot; DataSourceID=&quot;dsPopulationsSubPopulationfields&quot; DataTextField=&quot;field_description&quot; DataValueField=&quot;field_name&quot; AutoPostBack=&quot;True&quot;&gt; &lt;asp:ListItem Selected=&quot;True&quot;&gt;Not specified&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsPopulationsSubPopulationfields&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_SubPopulationFields&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; Sub-population&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlSubPopulation&quot; runat=&quot;server&quot; DataSourceID=&quot;dsPopulationsSubPopulation&quot; DataTextField=&quot;subpopulation_name&quot; DataValueField=&quot;subpopulation_name&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsPopulationsSubPopulation&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_SubPopulations&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbSelectionGroup&quot; runat=&quot;server&quot; OnCheckedChanged=&quot;cbSelectionGroup_CheckedChanged&quot; AutoPostBack=&quot;True&quot; Text=&quot;Selection group&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:Panel ID=&quot;pnlSelectionGroup&quot; runat=&quot;server&quot; Height=&quot;50px&quot; Visible=&quot;False&quot;&gt; &lt;table&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; Selection&amp;nbsp;group&amp;nbsp;field&amp;nbsp;filter&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlSelectionGroupFieldFilter&quot; runat=&quot;server&quot; AppendDataBoundItems=&quot;True&quot; DataSourceID=&quot;dsPopulationSelectionGroupsubPopulation&quot; DataTextField=&quot;field_description&quot; DataValueField=&quot;field_name&quot; AutoPostBack=&quot;True&quot;&gt; &lt;asp:ListItem Selected=&quot;True&quot;&gt;Not specified&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsPopulationSelectionGroupsubPopulation&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_SelectionGroups&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; Selection&amp;nbsp;group&amp;nbsp;sub&amp;#8209population&amp;nbsp;filter&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlSelectionGroupsubPopulationFilter&quot; runat=&quot;server&quot; AppendDataBoundItems=&quot;True&quot; DataSourceID=&quot;dsPopulationSubPopulationNames&quot; DataTextField=&quot;subpopulation_name&quot; DataValueField=&quot;subpopulation_name&quot; CausesValidation=&quot;True&quot;&gt; &lt;asp:ListItem Selected=&quot;True&quot;&gt;Not specified&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsPopulationSubPopulationNames&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_SubPopulations&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px; height: 10px&quot;&gt; Selection&amp;nbsp;group&lt;/td&gt; &lt;td style=&quot;width: 100px; height: 10px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlSelectionGroup&quot; runat=&quot;server&quot; DataSourceID=&quot;dsPopulationSelectionGroupSelectionGroup&quot; DataTextField=&quot;selection_group&quot; DataValueField=&quot;selection_group&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsPopulationSelectionGroupSelectionGroup&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_SelectionGroupsList&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt; &lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=&quot;2&quot; style=&quot;height: 16px; width: 268px;&quot;&gt; &lt;asp:CheckBox ID=&quot;cbTestPack&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; OnCheckedChanged=&quot;cbTestPack_CheckedChanged&quot; Text=&quot;Test/Pack&quot; /&gt; &lt;asp:Panel ID=&quot;pnlTestPack&quot; runat=&quot;server&quot; Height=&quot;50px&quot; Visible=&quot;False&quot;&gt; &lt;table&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbTest&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; OnCheckedChanged=&quot;cbTest_CheckedChanged&quot; Text=&quot;Test&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:Panel ID=&quot;pnlTest&quot; runat=&quot;server&quot; Height=&quot;50px&quot; Visible=&quot;False&quot;&gt; &lt;table&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; Type&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlType&quot; runat=&quot;server&quot; AppendDataBoundItems=&quot;True&quot; DataSourceID=&quot;dsTestTypes&quot; DataTextField=&quot;test_type&quot; DataValueField=&quot;test_type&quot; AutoPostBack=&quot;True&quot;&gt; &lt;asp:ListItem Selected=&quot;True&quot; Value=&quot;Not specified&quot;&gt;Any&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsTestTypes&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_TestTypes&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; Name&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlName&quot; runat=&quot;server&quot; DataSourceID=&quot;dsTestPackTestName&quot; DataTextField=&quot;test_name&quot; DataValueField=&quot;test_name&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsTestPackTestName&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_TestName&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt; &lt;SelectParameters&gt; &lt;asp:Parameter DefaultValue=&quot;N&quot; Name=&quot;test_order&quot; Type=&quot;String&quot; /&gt; &lt;/SelectParameters&gt; &lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbPack&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; OnCheckedChanged=&quot;cbPack_CheckedChanged&quot; Text=&quot;Pack&quot; /&gt;&lt;/td&gt; &lt;td style=&quot;width: 100px&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlPack&quot; runat=&quot;server&quot; Visible=&quot;False&quot; DataSourceID=&quot;dsTestPackPacks&quot; DataTextField=&quot;pack_description&quot; DataValueField=&quot;pack_code&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsTestPackPacks&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_Packs&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt;&lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 234px; height: 16px&quot;&gt; &lt;asp:CheckBox ID=&quot;cbCreatedBy&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; OnCheckedChanged=&quot;cbCreatedBy_CheckedChanged&quot; Text=&quot;Created by&quot; /&gt; &lt;asp:Panel ID=&quot;pnlCreatedBy&quot; runat=&quot;server&quot; Height=&quot;50px&quot; Visible=&quot;False&quot;&gt; &lt;asp:DropDownList ID=&quot;ddlCreatedBy&quot; runat=&quot;server&quot; DataSourceID=&quot;dsUsers4Client&quot; DataTextField=&quot;UserName&quot; DataValueField=&quot;UserName&quot; AutoPostBack=&quot;True&quot;&gt; &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID=&quot;dsUsers4Client&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:webtoolUserConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_Users4Client_Unique&quot; SelectCommandType=&quot;StoredProcedure&quot;&gt; &lt;SelectParameters&gt; &lt;asp:SessionParameter Name=&quot;pkClient_ID&quot; SessionField=&quot;pkClient_ID&quot; Type=&quot;Int32&quot; /&gt; &lt;/SelectParameters&gt; &lt;/asp:SqlDataSource&gt; &lt;/asp:Panel&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;br /&gt; &lt;asp:Label ID=&quot;lblErrorMessage&quot; runat=&quot;server&quot; CssClass=&quot;warning&quot; &gt;&lt;/asp:Label&gt;&lt;br /&gt; &lt;asp:GridView ID=&quot;GridView1&quot; runat=&quot;server&quot; EmptyDataText=&quot;No reports were found matching the above criteria.&quot; DataSourceID=&quot;dsReportList&quot; AllowSorting=&quot;True&quot; AutoGenerateColumns=&quot;False&quot; onrowcreated=&quot;GridView1_RowCreated&quot; OnSelectedIndexChanged=&quot;GridView1_SelectedIndexChanged&quot; DataKeyNames=&quot;report_name&quot; OnRowCommand=&quot;GridView1_RowCommand&quot;&gt; &lt;Columns&gt; &lt;asp:TemplateField ShowHeader=&quot;False&quot; Visible=False&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID=&quot;reportname&quot; Runat=&quot;Server&quot; Text='&lt;%# Eval(&quot;report_name&quot;) %&gt;' Visible=&quot;false&quot; /&gt; &lt;asp:Label ID=&quot;reportCategory&quot; Runat=&quot;Server&quot; Text='&lt;%# Eval(&quot;report_category&quot;) %&gt;' Visible=&quot;false&quot; /&gt; &lt;/ItemTemplate&gt; &lt;HeaderStyle BackColor=&quot;White&quot; /&gt; &lt;/asp:TemplateField&gt; &lt;asp:buttonfield commandname=&quot;View_Report&quot; ButtonType=&quot;Button&quot; text=&quot;View&quot; &gt; &lt;ControlStyle CssClass=&quot;button&quot; /&gt; &lt;HeaderStyle BackColor=&quot;White&quot; /&gt; &lt;/asp:buttonfield&gt; &lt;asp:buttonfield commandname=&quot;Delete_Report&quot; ButtonType=&quot;Button&quot; text=&quot;Delete&quot; &gt; &lt;ControlStyle CssClass=&quot;button&quot; /&gt; &lt;HeaderStyle BackColor=&quot;White&quot; /&gt; &lt;/asp:buttonfield&gt; &lt;asp:buttonfield commandname=&quot;Convert_Report&quot; ButtonType=&quot;Button&quot; text=&quot;Convert&quot; &gt; &lt;ControlStyle CssClass=&quot;button&quot; /&gt; &lt;HeaderStyle BackColor=&quot;White&quot; /&gt; &lt;/asp:buttonfield&gt; &lt;asp:CommandField ButtonType=&quot;Button&quot; ShowEditButton=&quot;True&quot; &gt; &lt;HeaderStyle BackColor=&quot;White&quot; /&gt; &lt;ControlStyle CssClass=&quot;button&quot; /&gt; &lt;/asp:CommandField&gt; &lt;asp:BoundField DataField=&quot;report_category&quot; HeaderText=&quot;Cat.&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;report_category&quot; /&gt; &lt;asp:BoundField DataField=&quot;offer_type&quot; HeaderText=&quot;Offer type&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;offer_type&quot; /&gt; &lt;asp:BoundField DataField=&quot;route_type&quot; HeaderText=&quot;Route type&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;route_type&quot; /&gt; &lt;asp:BoundField DataField=&quot;product_type&quot; HeaderText=&quot;Product type&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;product_type&quot; /&gt; &lt;asp:BoundField DataField=&quot;first_file_date&quot; HeaderText=&quot;First file date&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;first_file_date&quot; /&gt; &lt;asp:BoundField DataField=&quot;report_title&quot; HeaderText=&quot;Report title&quot; InsertVisible=&quot;False&quot; SortExpression=&quot;report_title&quot; /&gt; &lt;asp:BoundField DataField=&quot;start_date_formatted&quot; HeaderText=&quot;Creation date&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;start_date_formatted&quot; /&gt; &lt;asp:BoundField DataField=&quot;report_type&quot; HeaderText=&quot;Report type&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;report_type&quot; /&gt; &lt;asp:BoundField DataField=&quot;number_of_files&quot; HeaderText=&quot;# files&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;number_of_files&quot; /&gt; &lt;asp:BoundField DataField=&quot;customer_type&quot; HeaderText=&quot;Population - Customer type&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;customer_type&quot; /&gt; &lt;asp:BoundField DataField=&quot;subpopulation_name&quot; HeaderText=&quot;Population - sub-population&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;subpopulation_name&quot; /&gt; &lt;asp:BoundField DataField=&quot;selection_group&quot; HeaderText=&quot;Population - Selection group&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;selection_group&quot; /&gt; &lt;asp:BoundField DataField=&quot;product_type_eligibility&quot; HeaderText=&quot;Eligibility - product type&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;product_type_eligibility&quot; /&gt; &lt;asp:BoundField DataField=&quot;product_name_eligibility&quot; HeaderText=&quot;Eligibility - product name&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;product_name_eligibility&quot; /&gt; &lt;asp:BoundField DataField=&quot;offer_type_eligibility&quot; HeaderText=&quot;Eligibility - offer type&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;offer_type_eligibility&quot; /&gt; &lt;asp:BoundField DataField=&quot;contact_type_eligibility&quot; HeaderText=&quot;Eligibility - contact type&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;contact_type_eligibility&quot; /&gt; &lt;asp:BoundField DataField=&quot;product_type_holding&quot; HeaderText=&quot;Holds - product type&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;product_type_holding&quot; /&gt; &lt;asp:BoundField DataField=&quot;product_name_holding&quot; HeaderText=&quot;Holds - product name&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;product_name_holding&quot; /&gt; &lt;asp:BoundField DataField=&quot;promotion_code&quot; HeaderText=&quot;Promotion code&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;promotion_code&quot; /&gt; &lt;asp:BoundField DataField=&quot;userlongname&quot; HeaderText=&quot;Created by&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;userlongname&quot; /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;asp:SqlDataSource ID=&quot;dsReportList&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;%$ ConnectionStrings:WebTool1ConnectionString %&gt;&quot; SelectCommand=&quot;usp_SEL_ReportList&quot; SelectCommandType=&quot;StoredProcedure&quot; UpdateCommand=&quot;usp_UPD_AdHocReportTitle&quot; UpdateCommandType=&quot;StoredProcedure&quot; &gt; &lt;SelectParameters&gt; &lt;asp:ControlParameter ControlID=&quot;rblReportSource&quot; Name=&quot;radioReportSource&quot; PropertyName=&quot;SelectedValue&quot; Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlReportSource&quot; Name=&quot;reportSource&quot; PropertyName=&quot;SelectedValue&quot; Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbProductType&quot; Name=&quot;productTypeChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbRouteType&quot; Name=&quot;routeTypechecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbOfferType&quot; Name=&quot;offerTypeChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbReportType&quot; Name=&quot;reportTypeChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbPack&quot; Name=&quot;packChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbFirstFileDate&quot; Name=&quot;firstFileDateChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbCreatedBy&quot; Name=&quot;createdByChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbEFProductType&quot; Name=&quot;eFProductTypeChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbEFProductName&quot; Name=&quot;eFProductChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbEFOfferType&quot; Name=&quot;eFOfferTypeChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbEFContactType&quot; Name=&quot;eFContactTypeChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbHProductType&quot; Name=&quot;hProductTypeChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbHProductName&quot; Name=&quot;hProductNameChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbCustomerType&quot; Name=&quot;customerTypeChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbSubPopulation&quot; Name=&quot;subPopulationChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbSelectionGroup&quot; Name=&quot;selectionGroupChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;cbTest&quot; Name=&quot;testChecked&quot; PropertyName=&quot;Checked&quot; Type=&quot;Boolean&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlProductType&quot; Name=&quot;productType&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlRouteType&quot; Name=&quot;routeType&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlOfferType&quot; Name=&quot;offerType&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlReportType&quot; Name=&quot;reportType&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlPack&quot; Name=&quot;packCode&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlFirstFileDate&quot; Name=&quot;firstFileDate&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlCreatedBy&quot; Name=&quot;createdBy&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlEFProductType&quot; Name=&quot;eFProductType&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlEFProductName&quot; Name=&quot;eFProductName&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlEFOfferType&quot; Name=&quot;eFOfferType&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlEFContactType&quot; Name=&quot;eFContactType&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlHProductType&quot; Name=&quot;hProductType&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlHProductName&quot; Name=&quot;hProductName&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlCustomerType&quot; Name=&quot;customerType&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlSubPopulation&quot; Name=&quot;subPopulation&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlSelectionGroup&quot; Name=&quot;SelectionGroup&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlFileType&quot; Name=&quot;fileType&quot; PropertyName=&quot;SelectedItem.Text&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;asp:ControlParameter ControlID=&quot;ddlName&quot; Name=&quot;testName&quot; PropertyName=&quot;SelectedValue&quot; DefaultValue=Null Type=&quot;String&quot; /&gt; &lt;/SelectParameters&gt; &lt;UpdateParameters&gt; &lt;asp:Parameter Name=&quot;report_name&quot; Type=&quot;String&quot; /&gt; &lt;asp:Parameter Name=&quot;report_title&quot; Type=&quot;String&quot; /&gt; &lt;/UpdateParameters&gt; &lt;/asp:SqlDataSource&gt; &amp;nbsp;&lt;br /&gt; &lt;br /&gt; &lt;/asp:Content&gt;</pre>&nbsp;</p> 2007-02-09T10:46:49-05:001571908http://forums.asp.net/p/1072016/1571908.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Hi,</p> <p>I've got a solution for you, but hold onto your hat Cliff, there's a fair bit to it!!! OK... let's go for it....</p> <p>The real issue is that when you use markup, you can only &quot;bind&quot; the ConnectionString and ProviderName properties using expression builders (i.e. with &lt;%&#36; notation)... which limits you to&nbsp;Resources, AppSettings and ConnectionStrings. Fortunately, this is our saviour, as we can create our own ExpressionBuilder classes. What's more, with the power of Reflector, we can see what the existing ExpressionBuilder classes do, copy them and make our own modifications! So here's the plan...</p> <ol> <li>We create a new ExpressionBuilder class, called <font size="2"><strong>SessionConnectionStringsExpressionBuilder</strong></font> </li><li>We tell ASP.NET about the new expression builder class in <strong>web.config</strong> </li><li>We replace all normal &lt;%&#36; ConnectionStrings:<em>ConnectionString</em> %&gt; and &lt;%&#36; ConnectionStrings:<em>ConnectionString</em>.ProviderName %&gt; markup with our own expression builder calls &lt;%&#36; <strong>SessionConnectionStrings</strong>:<em>ConnectionString</em> %&gt; and &lt;%&#36; <strong> SessionConnectionStrings</strong>:<em>ConnectionString</em>.ProviderName %&gt;</li></ol> <p>Sounds simple in theory, and in practise it's pretty straightforward too... there's just a fair bit of code to paste in here!! But before I do that, we need to discuss the <strong>SessionConnectionStringsExpressionBuilder </strong>class. Here's how I designed things:</p> <ol> <li>I create a variable in the user's Session to store all our ConnectionStringSettings of type <font size="2"><strong>ConnectionStringSettingsCollection</strong>. The advantages of doing this&nbsp;are a)&nbsp;that it means we only use up 1 session variable and b) it can be easily substituted for <font size="2"><strong>ConfigurationManager.ConnectionStrings</strong></font></font> </li><li>I define a default key by which to store this session variable (&quot;SESSION_STATE_CONNECTION_STRINGS&quot;), but this can be overridden in the appSettings in the web.config file if you happen to be using that already for something else </li><li>I expose methods to Add and Remove connection string settings from the Session making it simple for you to code things </li><li>When you add connection string settings to the session, there <strong>must</strong> be a setting of the same name in the web.config connectionStrings section. </li><li>My reasoning for this last point is that the fallback position is to use a standard connection string if it doesn't exist in session... we can only adopt this fallback position if the connectionString exists!!</li></ol> <p>So enough rambling and on with the instructions... take a deep breath and follow!!</p> <p><strong><u>SessionConnectionStringsExpressionBuilder class</u></strong></p> <p>Create a new class in your App_Code directory and paste this code in:</p> <pre class="prettyprint">Imports System.Web Imports System.Web.Compilation Imports System.CodeDom Imports System.ComponentModel Imports System.Resources Imports System.Threading Imports System.Globalization Imports System.Security.Permissions &lt;ExpressionPrefix(&quot;SessionConnectionStrings&quot;)&gt; _ &lt;ExpressionEditor(&quot;System.Web.UI.Design.ConnectionStringsExpressionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot;), AspNetHostingPermission(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)&gt; _ Public Class SessionConnectionStringsExpressionBuilder Inherits ExpressionBuilder #Region &quot;Session Handling&quot; ' we will store alternative connection strings in session state in a collection under a single key ' this is the default key we'll use ' otherwise use ConnectionStringSessionKey in AppSettings Private Const DEFAULT_SESSION_KEY As String = &quot;SESSION_STATE_CONNECTION_STRINGS&quot; ' helper function to pull out the session key to use Private Shared Function GetSessionKey() As String ' see if the user has overridden the session key Dim SessionKey As String = ConfigurationManager.AppSettings.Get(&quot;ConnectionStringSessionKey&quot;) If String.IsNullOrEmpty(SessionKey) Then ' no so use the default SessionKey = DEFAULT_SESSION_KEY End If Return SessionKey End Function #End Region #Region &quot;AddConnectionStrings To Session&quot; Public Shared Sub AddConnectionStringSettings(ByVal settings As ConnectionStringSettings) ' see if we've got these connection string settings in the config file Dim cs As ConnectionStringSettings = ConfigurationManager.ConnectionStrings.Item(settings.Name) If cs Is Nothing Then ' no, so we've got no back up when the session times out... so throw an exception Throw New InvalidOperationException(SR.GetString(&quot;Connection_string_not_found&quot;, New Object() {settings.Name})) End If ' everything's OK, so add in the settings! GetConnectionStringSettings().Add(settings) End Sub Public Shared Sub AddConnectionStringSettings(ByVal name As String, ByVal connectionString As String) AddConnectionStringSettings(New ConnectionStringSettings(name, connectionString)) End Sub Public Shared Sub AddConnectionStringSettings(ByVal name As String, ByVal connectionString As String, ByVal providerName As String) AddConnectionStringSettings(New ConnectionStringSettings(name, connectionString, providerName)) End Sub Public Shared Sub RemoveConnectionStringSettings(ByVal settings As ConnectionStringSettings) GetConnectionStringSettings.Remove(settings) End Sub Public Shared Sub RemoveConnectionStringSettings(ByVal name As String) GetConnectionStringSettings.Remove(name) End Sub #End Region #Region &quot;ConnectionStrings Helper Functions&quot; Private Shared Function GetConnectionStringSettings() As ConnectionStringSettingsCollection Dim session As HttpSessionState = HttpContext.Current.Session Dim sessionKey As String = GetSessionKey() Dim connectionStrings As ConnectionStringSettingsCollection = session.Item(sessionKey) If connectionStrings Is Nothing Then connectionStrings = New ConnectionStringSettingsCollection() session.Item(sessionKey) = connectionStrings End If Return connectionStrings End Function Private Shared Function GetConnectionStringSettings(ByVal connectionStringName As String) As ConnectionStringSettings Dim css As ConnectionStringSettingsCollection = GetConnectionStringSettings() Dim cs As ConnectionStringSettings = css.Item(connectionStringName) If cs Is Nothing Then cs = ConfigurationManager.ConnectionStrings.Item(connectionStringName) End If Return cs End Function ' pulled from ConnectionStringExpressionBuilder class... just change how we get the connection strings collection! Public Shared Function GetConnectionString(ByVal connectionStringName As String) As String Dim settings1 As ConnectionStringSettings = GetConnectionStringSettings(connectionStringName) If (settings1 Is Nothing) Then Throw New InvalidOperationException(SR.GetString(&quot;Connection_string_not_found&quot;, New Object() {connectionStringName})) End If Return settings1.ConnectionString End Function Public Shared Function GetConnectionStringProviderName(ByVal connectionStringName As String) As String Dim settings1 As ConnectionStringSettings = GetConnectionStringSettings(connectionStringName) If (settings1 Is Nothing) Then Throw New InvalidOperationException(SR.GetString(&quot;Connection_string_not_found&quot;, New Object() {connectionStringName})) End If Return settings1.ProviderName End Function #End Region #Region &quot;Main ConnectionStringsExpressionBuilder Code&quot; ' pulled from ConnectionStringExpressionBuilder class... just change how we get the connection strings collection! Public Overrides Function GetCodeExpression(ByVal entry As System.Web.UI.BoundPropertyEntry, ByVal parsedData As Object, ByVal context As System.Web.Compilation.ExpressionBuilderContext) As System.CodeDom.CodeExpression Dim pair1 As Pair = DirectCast(parsedData, Pair) Dim text1 As String = CStr(pair1.First) If CBool(pair1.Second) Then Return New CodeMethodInvokeExpression(New CodeTypeReferenceExpression(MyBase.GetType), &quot;GetConnectionString&quot;, New CodeExpression() {New CodePrimitiveExpression(text1)}) End If Return New CodeMethodInvokeExpression(New CodeTypeReferenceExpression(MyBase.GetType), &quot;GetConnectionStringProviderName&quot;, New CodeExpression() {New CodePrimitiveExpression(text1)}) End Function Public Overrides Function EvaluateExpression(ByVal target As Object, ByVal entry As System.Web.UI.BoundPropertyEntry, ByVal parsedData As Object, ByVal context As System.Web.Compilation.ExpressionBuilderContext) As Object Dim pair1 As Pair = DirectCast(parsedData, Pair) Dim text1 As String = CStr(pair1.First) Dim flag1 As Boolean = CBool(pair1.Second) Dim settings1 As ConnectionStringSettings = SessionConnectionStringsExpressionBuilder.GetConnectionStringSettings(text1) If flag1 Then Return SessionConnectionStringsExpressionBuilder.GetConnectionString(text1) End If Return SessionConnectionStringsExpressionBuilder.GetConnectionStringProviderName(text1) End Function #Region &quot;Simple Copies From ConnectionStringExpressionBuilder Class&quot; Public Overrides ReadOnly Property SupportsEvaluate() As Boolean Get Return True End Get End Property Public Overrides Function ParseExpression(ByVal expression As String, ByVal propertyType As Type, ByVal context As ExpressionBuilderContext) As Object Dim text1 As String = String.Empty Dim flag1 As Boolean = True If (Not expression Is Nothing) Then If expression.EndsWith(&quot;.connectionstring&quot;, StringComparison.OrdinalIgnoreCase) Then text1 = expression.Substring(0, (expression.Length - &quot;.connectionstring&quot;.Length)) ElseIf expression.EndsWith(&quot;.providername&quot;, StringComparison.OrdinalIgnoreCase) Then flag1 = False text1 = expression.Substring(0, (expression.Length - &quot;.providername&quot;.Length)) Else text1 = expression End If End If Return New Pair(text1, flag1) End Function #End Region #End Region End Class #Region &quot;Resource Helper Class&quot; ' cut down version of System.Web.SR ' used to pull culture sensitive resources out of System.Web ' simply used Reflector to pull out what is required! Friend NotInheritable Class SR Private Shared loader As SR Private Shared s_InternalSyncObject As Object Private SRresources As ResourceManager Public Shared ReadOnly Property Resources() As ResourceManager Get Return SR.GetLoader.SRresources End Get End Property Private Shared ReadOnly Property InternalSyncObject() As Object Get If (SR.s_InternalSyncObject Is Nothing) Then Dim obj1 As New Object Interlocked.CompareExchange(SR.s_InternalSyncObject, obj1, Nothing) End If Return SR.s_InternalSyncObject End Get End Property Private Shared ReadOnly Property Culture() As CultureInfo Get Return Nothing End Get End Property Friend Sub New() Me.SRresources = New ResourceManager(&quot;System.Web&quot;, MyBase.GetType.Assembly) End Sub Public Shared Function GetString(ByVal name As String) As String Dim sr1 As SR = SR.GetLoader If (sr1 Is Nothing) Then Return Nothing End If Return sr1.SRresources.GetString(name, SR.Culture) End Function Public Shared Function GetString(ByVal name As String, ByVal ParamArray args As Object()) As String Dim sr1 As SR = SR.GetLoader If (sr1 Is Nothing) Then Return Nothing End If Dim text1 As String = sr1.SRresources.GetString(name, SR.Culture) If ((args Is Nothing) OrElse (args.Length &lt;= 0)) Then Return text1 End If Dim num1 As Integer = 0 Do While (num1 &lt; args.Length) Dim text2 As String = TryCast(args(num1), String) If ((Not text2 Is Nothing) AndAlso (text2.Length &gt; 1024)) Then args(num1) = (text2.Substring(0, 1021) &amp; &quot;...&quot;) End If num1 &#43;= 1 Loop Return String.Format(CultureInfo.CurrentCulture, text1, args) End Function Public Shared Function GetObject(ByVal name As String) As Object Dim sr1 As SR = SR.GetLoader If (sr1 Is Nothing) Then Return Nothing End If Return sr1.SRresources.GetObject(name, SR.Culture) End Function Private Shared Function GetLoader() As SR If (SR.loader Is Nothing) Then SyncLock SR.InternalSyncObject If (SR.loader Is Nothing) Then SR.loader = New SR End If End SyncLock End If Return SR.loader End Function End Class #End Region</pre>&nbsp;&nbsp; <P mce_keep="true"><STRONG><U>Set Up The web.config</U></STRONG></P> <P mce_keep="true">We now need to get ASP.NET to recognise our new expression builder... this is done by adding these lines in under the &lt;system.web&gt;&lt;compilation&gt; section:</P> <P mce_keep="true">&nbsp;&nbsp;&lt;<SPAN class=tag>compilation</SPAN><SPAN class=attr> debug=</SPAN><SPAN class=attrv>"false"</SPAN>&gt;<BR>&nbsp; &lt;<SPAN class=tag>expressionBuilders</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;<SPAN class=tag>add</SPAN><SPAN class=attr> expressionPrefix=</SPAN><SPAN class=attrv>"SessionConnectionStrings"</SPAN><BR><SPAN class=attr>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type=</SPAN><SPAN class=attrv>"SessionConnectionStringsExpressionBuilder"</SPAN>/&gt;<BR>&nbsp; &lt;/<SPAN class=tag>expressionBuilders</SPAN>&gt;<BR> <P>&nbsp;The expressionPrefix is what we will use in our markup.</P> <P><STRONG><U>Change Our Markup</U></STRONG></P><pre class="prettyprint">&lt;<SPAN class=tag>asp:SqlDataSource</SPAN><SPAN class=attr> ID=</SPAN><SPAN class=attrv>"SqlDataSource1"</SPAN><SPAN class=attr> runat=</SPAN><SPAN class=attrv>"server"</SPAN> <SPAN class=attr> ConnectionString=</SPAN><SPAN class=attrv>"<SPAN class=dir>&lt;%&#36;</SPAN> ConnectionStrings:MyConnectionString <SPAN class=dir>%&gt;</SPAN>"</SPAN> <SPAN class=attr> SelectCommand=</SPAN><SPAN class=attrv>"SELECT * FROM Authors"</SPAN> <SPAN class=attr> ProviderName=</SPAN><SPAN class=attrv>"<SPAN class=dir>&lt;%&#36;</SPAN> ConnectionStrings:MyConnectionString.ProviderName <SPAN class=dir>%&gt;</SPAN>"</SPAN> /&gt; </pre> <P>&nbsp;becomes</P><pre class="prettyprint">&lt;<SPAN class=tag>asp:SqlDataSource</SPAN><SPAN class=attr> ID=</SPAN><SPAN class=attrv>"SqlDataSource1"</SPAN><SPAN class=attr> runat=</SPAN><SPAN class=attrv>"server"</SPAN> <SPAN class=attr> ConnectionString=</SPAN><SPAN class=attrv>"<SPAN class=dir>&lt;%&#36;</SPAN> SessionConnectionStrings:MyConnectionString <SPAN class=dir>%&gt;</SPAN>"</SPAN> <SPAN class=attr> SelectCommand=</SPAN><SPAN class=attrv>"SELECT * FROM Authors"</SPAN> <SPAN class=attr> ProviderName=</SPAN><SPAN class=attrv>"<SPAN class=dir>&lt;%&#36;</SPAN> SessionConnectionStrings:MyConnectionString.ProviderName <SPAN class=dir>%&gt;</SPAN>"</SPAN> /&gt;</pre> <P><STRONG><U>Setting The Session Connection String</U></STRONG></P> <P>Now all you should need to do is set the&nbsp;session connection string. I've added some shared methods to the&nbsp;class&nbsp;to&nbsp;assist with&nbsp;that:</P><pre class="prettyprint"><SPAN class=kwd>Public Shared Sub</SPAN> AddConnectionStringSettings(<SPAN class=kwd>ByVal</SPAN> settings <SPAN class=kwd>As</SPAN> ConnectionStringSettings) <SPAN class=kwd>Public Shared Sub</SPAN> AddConnectionStringSettings(<SPAN class=kwd>ByVal</SPAN> name <SPAN class=kwd>As String</SPAN>, <SPAN class=kwd>ByVal</SPAN> connectionString <SPAN class=kwd>As String</SPAN>) <SPAN class=kwd>Public Shared Sub</SPAN> AddConnectionStringSettings(<SPAN class=kwd>ByVal</SPAN> name <SPAN class=kwd>As String</SPAN>, <SPAN class=kwd>ByVal</SPAN> connectionString <SPAN class=kwd>As String</SPAN>, <SPAN class=kwd>ByVal</SPAN> providerName <SPAN class=kwd>As String</SPAN>)</pre> <p>So you might call:</p> <p>SessionConnectionStringsExpressionBuilder.AddConnectionStringSettings(<span class="st">&quot;MyConnectionString&quot;</span>, <span class="st">&quot;xxx Connection Details xxx&quot;&quot;, &quot;</span>System.Data.SQLClient&quot;) </p> <p><strong><u>Caveat</u></strong> </p> <p>There's one minor caveat here... if you try and add the session connection string on Page_Init (etc)... the page has already evaluated the ExpressionBuilder for your SqlDataSource. So you will have to be a little bit careful about your coding logic, and might have to force a page reload. </p> <p>Good luck with this, let me know how you get on and if it's suitable for your situation/any problems you've got! </p> <p>Cheers, </p> <p>James</p> 2007-02-09T15:46:31-05:001571941http://forums.asp.net/p/1072016/1571941.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>WOW! </p> <p>James, many, many thanks.</p> <p>This looks like a great solution. You will have to allow me some time to understand it more fully and try and implement it - hopefully over the weekend - although I am already doing client work all weekend so I may struggle ;-)</p> <p>I will get to it ASAP and let you know how I get on. A couple of people from other forums have asked me to keep them posted on possible solutions so you may have made several people happy in one go!</p> <p>&nbsp;Thanks again and have a good weekend.</p> <p>&nbsp;Cliff</p> 2007-02-09T16:03:47-05:001572118http://forums.asp.net/p/1072016/1572118.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>No worries Cliff... the best way to understand what I've done is probably to use Reflector on the original ConnectionStringsExpressionBuilder class and look at the differences between that and what I've done... to be honest there aren't too many changes, just a conditional substitution between the ConfigurationManager and the Session!</p> <p>Cheers,</p> <p>&nbsp;</p> <p>James</p> 2007-02-09T17:51:23-05:001574510http://forums.asp.net/p/1072016/1574510.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Hi James,</p> <p>I'm getting a compliation error on the new ConnectionStringsExrpessionBuilder class that I don't understand:&nbsp;</p> <p>Error 102 Type 'CodeBLOCKED' is not defined. C:\Documents and Settings\Cliff\My Documents\My Webs\DataLabDotNet\App_Code\SessionConnectionStringsExpressionBuilder.vb 111 127 C:\...\DataLabDotNet\ </p> <p>&nbsp;Any suggestions?</p> <p>&nbsp;Thanks,</p> <p>&nbsp;Cliff</p> 2007-02-12T10:02:36-05:001574577http://forums.asp.net/p/1072016/1574577.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Hmmm... I'm a bit confused with that too!!</p> <p>Just googled CodeBLOCKED and it only seems to come up with a couple of hits... relating to Beta 2!</p> <p>Will have a look later for you... but in the meantime, can you confirm your environment for me please?</p> <p>I'm also contemplating putting together a SessionAppSettingsExpresssionBuilder and a SessionResourcesExpressionBuilder to finish this off... this will probably be a few days, and I need to find somewhere to upload the code to!<br> </p> <p>Thanks,</p> <p>&nbsp;</p> <p>James</p> 2007-02-12T11:36:20-05:001574610http://forums.asp.net/p/1072016/1574610.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Hi James,</p> <p>Thanks for the prompt response. I think I have it working! </p> <p>I changed the CodeBlocked to CodeExpression and it seems to work:</p> <font size="2"> <p></font><font color="#0000ff" size="2">If</font><font size="2"> </font><font color="#0000ff" size="2">CBool</font><font size="2">(pair1.Second) </font><font color="#0000ff" size="2">Then<br> </font><font color="#0000ff" size="2">Return</font><font size="2"> </font><font color="#0000ff" size="2">New</font><font size="2"> CodeMethodInvokeExpression(</font><font color="#0000ff" size="2">New</font><font size="2"> CodeTypeReferenceExpression(</font><font color="#0000ff" size="2">MyBase</font><font size="2">.GetType), </font><font color="#800000" size="2">&quot;GetConnectionString&quot;</font><font size="2">, </font><font color="#0000ff" size="2">New</font><font size="2"> CodeExpression() {</font><font color="#0000ff" size="2">New</font><font size="2"> CodePrimitiveExpression(text1)})<br> </font><font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">If<br> </font><font color="#0000ff" size="2">Return</font><font size="2"> </font><font color="#0000ff" size="2">New</font><font size="2"> CodeMethodInvokeExpression(</font><font color="#0000ff" size="2">New</font><font size="2"> CodeTypeReferenceExpression(</font><font color="#0000ff" size="2">MyBase</font><font size="2">.GetType), </font><font color="#800000" size="2">&quot;GetConnectionStringProviderName&quot;</font><font size="2">, </font><font color="#0000ff" size="2">New</font><font size="2"> CodeExpression() {</font><font color="#0000ff" size="2">New</font><font size="2"> CodePrimitiveExpression(text1)})</font></p> <p><font size="2">I don't know the significance of CodeBlocked so I may have screwed something up! However, I have successfully changed a connecting string and back again on a test page. I am getting an error sometimes pointing to line 44: <font size="2">GetConnectionStringSettings().Add(settings)</font></font><font size="2"><font size="2"></p> <p><em>&quot;The entry 'WebTool1ConnectionString' has already been added&quot;</em></p> <p>However,&nbsp;I suspect this is because I am doing this in Page_PreInit on my test page (and noting your caveat!) I will test more fully in the way I actually want to use it (setting the connection string once for the entire session when the user logs in). I'll let you know how I get on.</p> <p>I am using VisualStudio 2005 with ASP.Net 2 and using VB.Net, SQL Server 2005.</p> <p>Thanks again,</p> <p>Cliff</p> </font></font> 2007-02-12T12:05:20-05:001574620http://forums.asp.net/p/1072016/1574620.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Sorry James, I meant to include my amended version of the CodeBlocked lines:</p> <p><font size="2">&nbsp;</p> <p></font><font color="#0000ff" size="2">If</font><font size="2"> </font><font color="#0000ff" size="2">CBool</font><font size="2">(pair1.Second) </font><font color="#0000ff" size="2">Then</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">Return</font><font size="2"> </font><font color="#0000ff" size="2">New</font><font size="2"> CodeMethodInvokeExpression(</font><font color="#0000ff" size="2">New</font><font size="2"> CodeTypeReferenceExpression(</font><font color="#0000ff" size="2">MyBase</font><font size="2">.GetType), </font><font color="#800000" size="2">&quot;GetConnectionString&quot;</font><font size="2">, </font><font color="#0000ff" size="2">New</font><font size="2"> CodeExpression() {</font><font color="#0000ff" size="2">New</font><font size="2"> CodePrimitiveExpression(text1)})</p> <p></font><font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">If</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">Return</font><font size="2"> </font><font color="#0000ff" size="2">New</font><font size="2"> CodeMethodInvokeExpression(</font><font color="#0000ff" size="2">New</font><font size="2"> CodeTypeReferenceExpression(</font><font color="#0000ff" size="2">MyBase</font><font size="2">.GetType), </font><font color="#800000" size="2">&quot;GetConnectionStringProviderName&quot;</font><font size="2">, </font><font color="#0000ff" size="2">New</font><font size="2"> CodeExpression() {</font><font color="#0000ff" size="2">New</font><font size="2"> CodePrimitiveExpression(text1)})</font></p> <p><font size="2">Cliff</p> </font> 2007-02-12T12:12:42-05:001574661http://forums.asp.net/p/1072016/1574661.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Not sure what the CodeBLOCKED stuff is all about (or why you changed it!!!)... so can't help there!</p> <p>The error you're getting seems a little weird too... it looks like it is moaning because you've already added the connection string... but you are allowed to do that... it simply overwrites the connection string for the name! So again... don't know... you could try putting a try catch round that line... and then a bit of debugging!</p> 2007-02-12T12:53:32-05:001574772http://forums.asp.net/p/1072016/1574772.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>&nbsp;James,</p> <p>&nbsp;This is really confusing and difficult to discuss because the forum software here keeps changing the code snippets that I post. Below is a part of YOUR code&nbsp;as you originally posted it. This gives a compilation error aound the &quot;New CodeBLOCKED EXPRESSION&quot;, as reported above. </p> <pre class="prettyprint">#Region &quot;Main ConnectionStringsExpressionBuilder Code&quot; ' pulled from ConnectionStringExpressionBuilder class... just change how we get the connection strings collection! Public Overrides Function GetCodeExpression(ByVal entry As System.Web.UI.BoundPropertyEntry, ByVal parsedData As Object, ByVal context As System.Web.Compilation.ExpressionBuilderContext) As System.CodeDom.CodeExpression Dim pair1 As Pair = DirectCast(parsedData, Pair) Dim text1 As String = CStr(pair1.First) If CBool(pair1.Second) Then Return New CodeMethodInvokeExpression(New CodeTypeReferenceExpression(MyBase.GetType), &quot;GetConnectionString&quot;, <strong>New CodeBLOCKED EXPRESSION</strong> {New CodePrimitiveExpression(text1)}) End If Return New CodeMethodInvokeExpression(New CodeTypeReferenceExpression(MyBase.GetType), &quot;GetConnectionStringProviderName&quot;, <strong>New CodeBLOCKED EXPRESSION</strong> {New CodePrimitiveExpression(text1)}) End Function</pre> <p>&nbsp;I got around this by changing the <strong>codeBlocked</strong> part to just <strong> CodeExpression</strong> with <strong>()</strong> after it&nbsp;and this now seems to work (sorry but the forum won't let me actually type it exactly!)</p> <p>I wonder if the ASP.Net Forums software is detecting what it thinks is dangerous code being posted and is therfore BLOCKING it???? Please look at your original code as you pasted it and confirm you can see &quot;New CodeBLOCKED EXPRESSION&quot;. Is this what your original source code looked like?</p> <p>Thanks,</p> <p>Cliff</p> 2007-02-12T14:04:31-05:001574846http://forums.asp.net/p/1072016/1574846.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Aha!!! It's all making sense now!!! Looks like you are indeed right!! There is no CodeBLOCKED in my original code!!</p> <p>It obviously doesn't like that!!!! So when you change it, does everything work OK for you??</p> <p>I'm going to find somewhere to post the source code and create a link to it from there... will get on the case tonight!!</p> <p>&nbsp;Cheers,</p> <p>&nbsp;James</p> 2007-02-12T14:47:17-05:001574912http://forums.asp.net/p/1072016/1574912.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Yes, everything appears to be working fine after making that change. I am still testing but so far the ConnectionString is correctly changed based on the user logon and I have applied the markup changes (basically a simple 'change all' edit applied to the connection strings) to one of my more complicated&nbsp;pages and it appears to work perfectly. I don't pretend to understand what every line of your code does but I understand the approach and am REALLY grateful for all your help. Once you have a better place to post the code I will pass on&nbsp;the link to other people who are struggling with this if that is OK with you?</p> <p>Many, many thanks!</p> <p>Cliff</p> 2007-02-12T15:23:16-05:001574932http://forums.asp.net/p/1072016/1574932.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>No worries at all Cliff!! Glad you're all sorted. I'll drop a post once it's finished!<br> <br> Cheers,</p> <p>&nbsp;</p> <p>James</p> 2007-02-12T15:45:11-05:001575590http://forums.asp.net/p/1072016/1575590.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Hi Cliff,</p> <p>Have a look here:</p> <p><a href="http://2jsltd.co.uk/">http://2jsltd.co.uk/</a></p> <p><em>NB this is just a temporary location for it!!!</em></p> <p>Cheers,</p> <p><br> James</p> 2007-02-12T22:44:21-05:001575617http://forums.asp.net/p/1072016/1575617.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings Excellent! 2007-02-12T23:18:39-05:001575618http://forums.asp.net/p/1072016/1575618.aspx/1?Re+Dynamic+connection+stringsRe: Dynamic connection strings <p>Excellent! </p> <p>Cliff</p> 2007-02-12T23:18:46-05:00