jasonsalas
IS-IT--Management
Hi everyone,
Got a new one: I'm trying to evaluate the contents of one event and pass this information on to a subsequent method, but it's coming out funny. Basically I have a DataGrid that allows a user to display his personal buddy list or a public list, accesible to everyone, or a company-only list.
He can toggle between the two using LinkButton controls on the page. When a user clicks on whichever view to see, I assign a flag in ViewState to keep track of what view he's currently on. Editing mode is enabled for the DataGrid, but when I enter edit Edit mode, it doesn't have the right set of data (the right specific record), implying wrong command arguments being passed in.
Here's the event handler I'm using:
public void Edit_Contacts(object sender, DataGridCommandEventArgs e)
{
// get the specific record you need to enter edit mode for...
dgContacts.EditItemIndex = e.Item.ItemIndex;
// ...and display that record's data
string mode = (string)ViewState["viewMode"];
if(mode != null)
{
switch(mode)
{
case "PRIVATE":
GetMyList(this,e);
break;
case "ALL":
GetAll(this,e);
break;
case "NTERNAL":
GetInternal(this,e);
break;
}
}
}
However, the events specified in the Switch statement all have argument lists that are of type CommandEventArgs, so the signatures are inconsistent (the first event handler is of type DataGridCommandEventArgs):
// example...they're all like this
protected void GetAll(object sender, CommandEventArgs e)
I tried casting the arguments in e to the destination type of CommandEventArgs, but no dice. Got any ideas?
Thanks!
Jas
Got a new one: I'm trying to evaluate the contents of one event and pass this information on to a subsequent method, but it's coming out funny. Basically I have a DataGrid that allows a user to display his personal buddy list or a public list, accesible to everyone, or a company-only list.
He can toggle between the two using LinkButton controls on the page. When a user clicks on whichever view to see, I assign a flag in ViewState to keep track of what view he's currently on. Editing mode is enabled for the DataGrid, but when I enter edit Edit mode, it doesn't have the right set of data (the right specific record), implying wrong command arguments being passed in.
Here's the event handler I'm using:
public void Edit_Contacts(object sender, DataGridCommandEventArgs e)
{
// get the specific record you need to enter edit mode for...
dgContacts.EditItemIndex = e.Item.ItemIndex;
// ...and display that record's data
string mode = (string)ViewState["viewMode"];
if(mode != null)
{
switch(mode)
{
case "PRIVATE":
GetMyList(this,e);
break;
case "ALL":
GetAll(this,e);
break;
case "NTERNAL":
GetInternal(this,e);
break;
}
}
}
However, the events specified in the Switch statement all have argument lists that are of type CommandEventArgs, so the signatures are inconsistent (the first event handler is of type DataGridCommandEventArgs):
// example...they're all like this
protected void GetAll(object sender, CommandEventArgs e)
I tried casting the arguments in e to the destination type of CommandEventArgs, but no dice. Got any ideas?
Thanks!
Jas