Click here to Skip to main content
15,887,453 members
Home / Discussions / C#
   

C#

 
GeneralRe: icon changes when apps are grouped in taskbar Pin
rbuchana20-Jan-09 15:14
rbuchana20-Jan-09 15:14 
QuestionCryptography Pin
Scalee20-Jan-09 13:47
Scalee20-Jan-09 13:47 
AnswerRe: Cryptography Pin
Mark Churchill20-Jan-09 14:43
Mark Churchill20-Jan-09 14:43 
AnswerRe: Cryptography Pin
Guffa20-Jan-09 14:46
Guffa20-Jan-09 14:46 
QuestionHow to use WSDL in VS2008 Pin
Scott Elder20-Jan-09 13:31
Scott Elder20-Jan-09 13:31 
QuestionDataGridView, RowEnter exception upon header select Pin
Lodeclaw20-Jan-09 11:46
Lodeclaw20-Jan-09 11:46 
AnswerRe: DataGridView, RowEnter exception upon header select Pin
Lodeclaw20-Jan-09 11:53
Lodeclaw20-Jan-09 11:53 
QuestionSession states between two pages with two gridtables Pin
CrimeanTurtle200820-Jan-09 11:40
CrimeanTurtle200820-Jan-09 11:40 
Hi all,

I have two aspx pages which have one gridview table each. the second gridview is dependent on the other based on which row you select in the first gridview table.
Ive used the configuraztion wizard for the 2nd table to generate the table based on the session value ie Session["Selection"].

However the problem occurs when, Im using session values between the pages, and when the event handler is fired, it doesnt transfer the session value to the next page and hence the 2nd pages shows nothing.

I managed succeed in doing this in another project and have compared it many a time yet I cannot spot the difference in the way I have coded this. Yet one works and the other doesnt.


Heres my code. Thanks + Cheers

1st page

//event handler
protected void ViewCustomer(object sender, EventArgs e)
    {
        Session["Selection"] = GridView1.SelectedDataKey.Value
        Response.Redirect("~/Master/SelectionBetweenTwoPagesPageTwo.aspx");
    }

//source code 

<asp:gridview id="GridView1" runat="server" autogeneratecolumns="False" xmlns:asp="#unknown">
            CellPadding="4" DataKeyNames="CustomerID" DataSourceID="SqlDataSource1" 
            ForeColor="#333333" GridLines="None" Height="139px" 
            OnSelectedIndexChanged="ViewCustomer" Width="448px">
            <footerstyle backcolor="#990000" font-bold="True" forecolor="White" />
            <rowstyle backcolor="#FFFBD6" forecolor="#333333" />
            <columns>
                <asp:boundfield datafield="CustomerID" headertext="CustomerID" readonly="false">
                    SortExpression="CustomerID" />
                <asp:boundfield datafield="CompanyName" headertext="CompanyName">
                    SortExpression="CompanyName" />
                <asp:boundfield datafield="ContactName" headertext="ContactName">
                    SortExpression="ContactName" />
                <asp:boundfield datafield="ContactTitle" headertext="ContactTitle">
                    SortExpression="ContactTitle" />
                <asp:hyperlinkfield navigateurl="~/Master/SelectionBetweenTwoPagesPageTwo.aspx">
                    Text="View"  />
            </asp:hyperlinkfield></asp:boundfield></asp:boundfield></asp:boundfield></asp:boundfield></columns>
            <pagerstyle backcolor="#FFCC66" forecolor="#333333" horizontalalign="Center" />
            <selectedrowstyle backcolor="#FFCC66" font-bold="True" forecolor="Navy" />
            <headerstyle backcolor="#990000" font-bold="True" forecolor="White" />
            <alternatingrowstyle backcolor="White" />
        </asp:gridview>
        <asp:sqldatasource id="SqlDataSource1" runat="server" xmlns:asp="#unknown">
            ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString %>" 
            SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName], [ContactTitle] FROM [Customers]">
        </asp:sqldatasource>


//2nd page


    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Selection"] != null)
        {
            int customerid = (int)Session["Selection"];
        }

    }

AnswerRe: Session states between two pages with two gridtables Pin
Colin Angus Mackay20-Jan-09 13:13
Colin Angus Mackay20-Jan-09 13:13 
GeneralRe: Session states between two pages with two gridtables Pin
CrimeanTurtle200820-Jan-09 13:29
CrimeanTurtle200820-Jan-09 13:29 
QuestionStream / MemoryStream Pin
Jacob D Dixon20-Jan-09 11:18
Jacob D Dixon20-Jan-09 11:18 
AnswerRe: Stream / MemoryStream Pin
Wendelius20-Jan-09 11:47
mentorWendelius20-Jan-09 11:47 
GeneralRe: Stream / MemoryStream Pin
Jacob D Dixon20-Jan-09 12:32
Jacob D Dixon20-Jan-09 12:32 
AnswerRe: Stream / MemoryStream Pin
Ennis Ray Lynch, Jr.20-Jan-09 12:46
Ennis Ray Lynch, Jr.20-Jan-09 12:46 
AnswerRe: Stream / MemoryStream Pin
Guffa20-Jan-09 12:56
Guffa20-Jan-09 12:56 
GeneralRe: Stream / MemoryStream Pin
Jacob D Dixon20-Jan-09 13:06
Jacob D Dixon20-Jan-09 13:06 
GeneralRe: Stream / MemoryStream Pin
Jacob D Dixon20-Jan-09 13:38
Jacob D Dixon20-Jan-09 13:38 
GeneralRe: Stream / MemoryStream Pin
Ben Fair21-Jan-09 2:36
Ben Fair21-Jan-09 2:36 
QuestionSolutions and Projects Pin
mobius11100120-Jan-09 9:24
mobius11100120-Jan-09 9:24 
AnswerRe: Solutions and Projects Pin
Wes Aday20-Jan-09 9:33
professionalWes Aday20-Jan-09 9:33 
AnswerRe: Solutions and Projects Pin
mobius11100120-Jan-09 9:44
mobius11100120-Jan-09 9:44 
GeneralRe: Solutions and Projects Pin
Wes Aday20-Jan-09 10:27
professionalWes Aday20-Jan-09 10:27 
GeneralRe: Solutions and Projects Pin
#realJSOP20-Jan-09 10:46
mve#realJSOP20-Jan-09 10:46 
GeneralRe: Solutions and Projects Pin
led mike20-Jan-09 11:42
led mike20-Jan-09 11:42 
GeneralRe: Solutions and Projects Pin
#realJSOP20-Jan-09 23:27
mve#realJSOP20-Jan-09 23:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.