I want to use a click button to go to next page, and display the detail info of the person i select. but this code wont work. help help!

void ButtonHandler(Object sender, EventArgs e)
        {
            Button ViewReports = (Button)sender;
            switch (ViewReports.CommandName)
            {
                case "ViewReportsClick":
                    Response.Redirect(ViewReports.CommandArgument.ToString());
                    break;
                case "ViewRemunerationClick":
                    Response.Redirect(ViewRemuneration.CommandArgument.ToString());
                    break;
                case "ViewPerformanceClick":
                    Response.Redirect(ViewPerformance.CommandArgument.ToString());
                    break;
            }
        }

when i was a beginner and asked such questions, my co-workers would ask me "have you debugged the code". that is what i suggest to you, put a break point to your switch case and then start debugging. you will see what is wrong with it.

What doesn't work about your code? Does it not compile, does it not redirect, does it never get called?

What doesn't work about your code? Does it not compile, does it not redirect, does it never get called?

in other words, why dont you debug it ? :)

I have three different button, and i use this code. if i click any of the buttons, it will return to page load. There's an employee detail and i want to show their further details; either their reports, remuneration, or performance; using the button, according to which the user select.

missbeginner, do you know how to debug an application?

yes. everything looks fine it's just the button won't lead me to selected detail of an ID, it leads to the first page of database

oh! find it, i think i suppose to use the "request ID" command in the other page. i'll try that one, thanks everyone, sorry for the hassle

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.