Re: Getting Control ID of buttons in Buttoncolumn in a Datagrid

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Cowboy \(Gregory A. Beamer\) [MVP] (NoSpamMgbworld_at_comcast.netNoSpamM)
Date: 07/07/04


Date: Wed, 7 Jul 2004 07:47:55 -0500

Try branching inside the routine called from the button click rather than
attempting to call different routines. In other words, you know the
reasoning behind the different events being called (first click, second
click, or similar), so you can branch based on that. For example (C#):

//At top of page (declarations)
protected int clickNumber = 0;

private void Button1_Click(Object sender, EventArgs e)
{
    'Set click number higher for this click
    'NOTE: can do this after, if you want 0 to be your start
    clickNumber += 1;

    switch(clickNumber)
    {
        case 1:
            //Code on first click
            break;
        case 2:
            //Code on second click
            break;
        case 3:
            //Code on third click
            break;
        default:
            //Code on all other clicks
            break;
    }
}

-- 
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
************************************************
Think Outside the Box!
************************************************
"DotNetJunkies User" <User@-NOSPAM-DotNetJunkies.com> wrote in message
news:eWs6NfBZEHA.3156@TK2MSFTNGP12.phx.gbl...
> Hi ,
>          I hav a buttoncolumn(pushBackButton)  in my datagrid. And on
click of every button i want to call different methods(server side).
>
> Kindly help me out..!!!!!!!!
> Thnx,
> Rameshwar,Govindu.
>
>
> ---
> Posted using Wimdows.net NntpNews Component -
>
> Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup
engine supports Post Alerts, Ratings, and Searching.

Quantcast