Newbie question

I have the following code.

private void rGridDateSearch_SelectedIndexChanged(object sender, EventArgs e)
{
    // Obtain the index of the selected row
    int selectedRowIndex = rGridDateSearch.SelectedIndex;
    // Read the employee ID
    int [COLOR="Red"]IDNumbe[/COLOR]r = (Int32)rGridDateSearch.DataKeys[selectedRowIndex].Value;
    [COLOR="red"]BindDetails();[/COLOR]
}

I want to be able to be able to send IDNumber to BindDetails() from a number of different methods (is that the right terminology?), but I cannot find how to do this - I’m sure it is easy.

My BindDetails method will use IDNumber to perform a query.

Thanks for the help

if you want to send IDNumber to BindDetails() then BindDetails should look like this:

BindDetails(int IDNumber) { 
// Do Something
 }

then you can plug any int into it.

Thanks for the quick help!

I also changed my code above to have IDNumber in the sending code as -

private void rGridDateSearch_SelectedIndexChanged(object sender, EventArgs e)
{
// Obtain the index of the selected row
int selectedRowIndex = rGridDateSearch.SelectedIndex;
// Read the employee ID
int IDNumber = (Int32)rGridDateSearch.DataKeys[selectedRowIndex].Value;
BindDetails(IDNumber);
}

Did I have to do that (I was getting an error before doing that)?

edit - now I see that is what “then you can plug any int into it.” meant

Yes, you must do that. If you change the signature to require an int you need to send one to it. :slight_smile: