Velocity Reviews

Velocity Reviews (
-   ASP .Net Building Controls (
-   -   Dynamic temp. datagrid col.gen. -Session access inside a class inside a UserCtrl (

Andy Eshtry 03-01-2004 11:48 PM

Dynamic temp. datagrid col.gen. -Session access inside a class inside a UserCtrl
Hello Dear Professionals:
Based on this document:
or this
I want to create 3 template column in datagrid dynamically while the
template columns
contains image buttons for add, edit and delete. As you can see, I can
figure out the commandname inside the imageButton_Command event but I do not
know how can store info in session object and also use response.redirect
inside that event cause it is in the DataGridTemplate Class not the upper
user control which contains that class. Also access other datagrid columns'
data like id of current datagrid row.
Thank you very much for your kind attention.
Best Wishes
Andy Eshtry

public class DataGridTemplate : System.Web.UI.ITemplate
ListItemType templateType;
string columnName;

public DataGridTemplate(ListItemType type, string colname)
templateType = type;
columnName = colname;

public void InstantiateIn(System.Web.UI.Control container)
Literal lc = new Literal();
case ListItemType.Header:
lc.Text = "<B>" + columnName + "</B>";
case ListItemType.Item:
ImageButton imageButton = new ImageButton();
imageButton.ImageUrl = "../Images/view.png";
imageButton.AlternateText = columnName;
imageButton.Command += new CommandEventHandler(imageButton_Command);
imageButton.CommandName = "View";

void imageButton_Command(object sender, CommandEventArgs e)
if (e.CommandName == "View")
//can not use session or response.redirect or how can I sent commandname up
to container user control or access other datagrid columns's data

All times are GMT. The time now is 12:44 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.