PC Review


Reply
Thread Tools Rate Thread

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

 
 
Andy Eshtry
Guest
Posts: n/a
 
      2nd Mar 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.pcreview.co.uk/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
Rate This Thread
Rate This Thread:

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
Dynamic Creation of Hashtable inside Custom TemplateField Class (Complex) pbd22 Microsoft ASP .NET 0 29th Oct 2007 12:07 AM
Dynamic temp. datagrid col.gen. -Session access inside a class inside a UserCtrl Andy Eshtry Microsoft Dot NET 0 2nd Mar 2004 12:47 AM
Dynamic temp. datagrid col.gen. -Session access inside a class inside a UserCtrl Andy Eshtry Microsoft C# .NET 0 2nd Mar 2004 12:47 AM
Dynamic temp. datagrid col.gen. -Session access inside a class inside a UserCtrl Andy Eshtry Microsoft VB .NET 0 2nd Mar 2004 12:47 AM
Access DataGrid declared in derived class from base class?? Jonas Microsoft ASP .NET 1 12th Aug 2003 05:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:16 AM.