Is there any way to force this post back without clicking on a
dropdownlist?
I tried making the gridview visible and invisible by settting its
'visible' property, and that did not work. I tried putting it in a
panel and setting that to visible and invisible, but that did not
work.
I did get advice to force execution of the select statement in the sql
data source control, but how does one do that?
Thanks for any help.
-- Marvin
If you can't figure it out after than then post your code. Including the
ASPX.
Hope that helps,
Fernando L Rodriguez, MCP
<COHEN...@lycos.com> wrote in message
news:3e1eae19-9d81-4f0a...@e53g2000hsa.googlegroups.com...
Here is the code - it is in a usercontrol.
Protected Sub btnGetData_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnGetData.Click
LoadGridView()
End Sub
Protected Sub LoadGridView()
Dim SQL As String = ""
Dim Dt As New Data.DataTable
Dim StartDate As Date = #1/1/1900#
Dim EndDate As Date = #1/1/1900#
Dim ReportName As String = ""
If IsDate(Me.txtStartDate.Text) Then
StartDate = Convert.ToDateTime(Me.txtStartDate.Text)
Else
Me.lblMessage.Text = "Enter a Start Date to Continue"
Exit Sub
End If
If IsDate(Me.txtEndDate.Text) Then
EndDate = Convert.ToDateTime(Me.txtEndDate.Text)
Else
Me.lblMessage.Text = "Enter an End Date to Continue"
Exit Sub
End If
If StartDate > EndDate Then
Me.lblMessage.Text = "Start Date Cannot Be GREATER than
End Date"
Exit Sub
End If
Dim strReportName As String
strReportName = Me.ddlReports.SelectedValue
If strReportName = "Select a Report" Then
Me.lblMessage.Text = "Select a Report to Continue!"
Exit Sub
End If
ReportName = GetsProcForReport()
lblDebug.Text = "strReportName is " & strReportName.ToUpper
If strReportName.ToUpper.Trim = "DAILY OUTREACH" Then
Delete3OutreachTablesUnusedRecords()
Session("DOStartDate") = Me.txtStartDate.Text
Session("DOEndDate") = Me.txtEndDate.Text
Session("DOAgencyName") =
Me.DropDownListAgencies.SelectedItem.Text
Me.SqlDataSourceDailyOutreachReport.DataBind()
Me.GridViewDailyOutreachReport2.DataBind()
Me.lblDebug.Text = Session("DOStartDate") & ", " &
Session("DOEndDate") & ", " & Session("DOAgencyName")
And here is the ascx code:
<asp:Label ID="lblDebug" runat="server" ForeColor="Lime"
Width="431px"></asp:Label>
<table>
<tr>
<td style="width: 3px">
<asp:Label ID="lblStartDate" runat="server"
Text="Start Date" Width="80px" ForeColor="Black"></asp:Label></td>
<td style="width: 3px">
<asp:TextBox ID="txtStartDate" runat="server"
Width="90px" BorderStyle="Groove"></asp:TextBox></td>
<td style="width: 3px">
<asp:ImageButton ID="imgStartDate" runat="server"
ImageUrl="~/images/Calendar_scheduleHS.bmp"
ValidationGroup="txtStartDate" /></td>
<td style="width: 3px">
<asp:Label ID="lblPholder1" runat="server"
ForeColor="White" Text="__"></asp:Label></td>
<td style="width: 3px">
<asp:Label ID="lblEndDate" runat="server"
ForeColor="Black" Text="End Date" Width="80px"></asp:Label></td>
<td style="width: 3px">
<asp:TextBox ID="txtEndDate" runat="server"
BorderStyle="Groove" Width="90px"></asp:TextBox></td>
<td style="width: 3px"><asp:ImageButton ID="imgEndDate"
runat="server" ImageUrl="~/images/Calendar_scheduleHS.bmp"
ValidationGroup="txtEndDate" /></td>
<td style="width: 3px">
</td>
</tr>
<tr>
<td style="width: 3px">
<asp:Label ID="Label1" runat="server"
ForeColor="White" Text="-" Width="80px"></asp:Label></td>
<td style="width: 3px">
</td>
<td style="width: 3px">
</td>
<td style="width: 3px">
</td>
<td style="width: 3px">
</td>
<td style="width: 3px">
</td>
<td style="width: 3px">
</td>
<td style="width: 3px">
</td>
</tr>
<tr>
<td colspan="2">
<asp:DropDownList ID="ddlReports" runat="server"
Width="181px" AutoPostBack="True">
</asp:DropDownList></td>
<td colspan="3">
<asp:Button ID="btnGetData" runat="server"
OnClick="btnGetData_Click" Text="Generate Report" Width="123px" /></
td>
<td colspan="3">
<asp:Button ID="btnExport" runat="server"
OnClick="btnExport_Click" Text="Export To Excel" Width="116px" /></td>
</tr>
<tr><td colspan="8" align="center">
<asp:Label ID="LblAgencies" runat="server"
Text="Agencies" ForeColor="Black" Visible="False"></asp:Label>
<asp:DropDownList ID="DropDownListAgencies" runat="server"
Visible="False">
</asp:DropDownList><br />
</td></tr>
<tr>
<td colspan="8">
<asp:Label ID="Label2" runat="server"
ForeColor="White" Text="__"></asp:Label></td>
</tr>
<tr>
<td colspan="8">
</td>
</tr>
</table>
asdfsdafasdfasd<asp:SqlDataSource
ID="SqlDataSourceDailyOutreachReport" runat="server"
ConnectionString="<%$
ConnectionStrings:DBDHSCentralConnectionString %>"
SelectCommand="DailyOutreachReport"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:SessionParameter Name="StartDate"
SessionField="DOStartDate" Type="DateTime" />
<asp:SessionParameter Name="endDate"
SessionField="DOEndDate" Type="DateTime" />
<asp:SessionParameter Name="AgencyName"
SessionField="DOAgencyName" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridViewDailyOutreachReport2" runat="server"
AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID"
DataSourceID="SqlDataSourceDailyOutreachReport">
<Columns>
<asp:CommandField ButtonType="Button" ShowSelectButton="True" /
>
<asp:BoundField DataField="ID" HeaderText="ID"
InsertVisible="False" ReadOnly="True"
SortExpression="ID" Visible="False" />
<asp:BoundField DataField="Date Reported" HeaderText="Date
Reported" SortExpression="Date Reported" />
<asp:BoundField DataField="Date Submitted" HeaderText="Date
Submitted" SortExpression="Date Submitted" />
<asp:BoundField DataField="Agency Name" HeaderText="Agency
Name" SortExpression="Agency Name" />
</Columns>
</asp:GridView>
<br />
THANKS