Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-22-2011, 04:26 PM   PM User | #1
dougancil
New to the CF scene

 
Join Date: Apr 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
dougancil is an unknown quantity at this point
Passing variables from one page to another

I have two web pages that I'm passing variables that are needed for 2 sql stored procedures to fill a datatable. The user will see their results on page one, click on a link and be taken to page 2, which passes the variables in the URL. I can see that the variables are being passed to the second page, but my stored procedure isn't firing. Here is my code for the datatable on the first page:

Code:
 <asp:GridView ID="GridView1" runat="server" HorizontalAlign="Center" 
            AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="SchedName" HeaderText="SchedName" 
                    SortExpression="SchedName" />
                <asp:BoundField DataField="ActivityDate" HeaderText="ActivityDate" 
                    ReadOnly="True" SortExpression="ActivityDate" />
                <asp:BoundField DataField="By" HeaderText="By" SortExpression="By" />
                <asp:BoundField DataField="Activity" HeaderText="Activity" ReadOnly="True" 
                    SortExpression="Activity" />
                <asp:BoundField DataField="FirstListing" HeaderText="FirstListing" 
                    SortExpression="FirstListing" />
             <asp:TemplateField HeaderText="OncallStart" SortExpression="OnCallStart"> 
    <ItemTemplate> 
        <asp:HyperLink ID="OnCallStart" runat="server" Text='<%# Eval("OncallStart") %>' 
             NavigateUrl='<%# String.Format("\website1\Default2.aspx?schedname={0}&date={1}", Eval("schedname"), Eval("OncallStart")) %>' /> 
    </ItemTemplate> 
</asp:TemplateField>   
                <asp:BoundField DataField="OnCallEnd" HeaderText="OnCallEnd" ReadOnly="True" 
                    SortExpression="OnCallEnd" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MDRConnectionString %>" 
            SelectCommand="sp_getoncallresults" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:ControlParameter ControlID="sincedateTextBox" DbType="DateTime" 
                    Name="sincedate" PropertyName="Text" />
                <asp:ControlParameter ControlID="schednameTextBox" Name="schedname" 
                    PropertyName="Text" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
and here is the URL when a user clicks on the link in the datagridview:

http://10.2.1.66/website1/Default2.a...205:00:00%20PM

and here is the code for the datagridview on page 2:
Code:
  <asp:GridView ID="GridView1" runat="server" style="text-align: center" 
            AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="SchedName" HeaderText="SchedName" 
                    SortExpression="SchedName" />
                <asp:HyperLinkField DataTextField="ActivityDate" HeaderText="ActivityDate" 
                    NavigateUrl="\website1\default.aspx" SortExpression="ActivityDate" />
                <asp:BoundField DataField="By" HeaderText="By" SortExpression="By" />
                <asp:BoundField DataField="Activity" HeaderText="Activity" ReadOnly="True" 
                    SortExpression="Activity" />
                <asp:BoundField DataField="FirstListing" HeaderText="FirstListing" 
                    SortExpression="FirstListing" />
            </Columns>
        </asp:GridView>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MDRConnectionString %>" 
            ProviderName="System.Data.SqlClient" SelectCommand="sp_getoncallresults3" 
            SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:QueryStringParameter DbType="DateTime" Name="date" 
                    QueryStringField="date" />
                <asp:QueryStringParameter  DbType="String"  Name="schedname" 
                    QueryStringField="schedname"  />
                <asp:Parameter Direction="ReturnValue" Name="RETURN_VALUE" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
And on the form load event of page 2 I have this line of code:

Code:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Convert.ToDateTime(Request.QueryString("date")).ToShortDateString()
    End Sub
I have verified all of my variable names and types against my database and I'm not seeing any results. What am I missing?

Thank you

Doug
dougancil is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:30 PM.


Advertisement
Log in to turn off these ads.