Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Dynamic temp. datagrid col.gen. -Session access inside a class inside a UserCtrl

Reply
Thread Tools

Dynamic temp. datagrid col.gen. -Session access inside a class inside a UserCtrl

 
 
Andy Eshtry
Guest
Posts: n/a
 
      03-01-2004
Hello Dear Professionals:
Based on this document:
http://msdn.microsoft.com/library/de...ynamically.asp
or this http://www.dnzone.com/ShowDetail.asp?NewsId=599
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
http://www.velocityreviews.com/forums/(E-Mail Removed)


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();
switch(templateType)
{
case ListItemType.Header:
lc.Text = "<B>" + columnName + "</B>";
container.Controls.Add(lc);
break;
case ListItemType.Item:
ImageButton imageButton = new ImageButton();
imageButton.ImageUrl = "../Images/view.png";
imageButton.AlternateText = columnName;
imageButton.Command += new CommandEventHandler(imageButton_Command);
imageButton.CommandName = "View";
container.Controls.Add(imageButton);
break;
}
}

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
}
}


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
Dynamic temp. datagrid col.gen. -Session access inside a class inside a UserCtrl Andy Eshtry ASP .Net Datagrid Control 0 03-01-2004 11:48 PM
Dynamic temp. datagrid col.gen. -Session access inside a class inside a UserCtrl Andy Eshtry ASP .Net Building Controls 0 03-01-2004 11:48 PM
Dynamic temp. datagrid col.gen. -Session access inside a class inside a UserCtrl Andy Eshtry ASP .Net Web Controls 0 03-01-2004 11:47 PM



Advertisments