473,765 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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_Com mand event but I do not
know how can store info in session object and also use response.redire ct
inside that event cause it is in the DataGridTemplat e 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
an********@hotm ail.com
public class DataGridTemplat e : System.Web.UI.I Template
{
ListItemType templateType;
string columnName;

public DataGridTemplat e(ListItemType type, string colname)
{
templateType = type;
columnName = colname;
}

public void InstantiateIn(S ystem.Web.UI.Co ntrol container)
{
Literal lc = new Literal();
switch(template Type)
{
case ListItemType.He ader:
lc.Text = "<B>" + columnName + "</B>";
container.Contr ols.Add(lc);
break;
case ListItemType.It em:
ImageButton imageButton = new ImageButton();
imageButton.Ima geUrl = "../Images/view.png";
imageButton.Alt ernateText = columnName;
imageButton.Com mand += new CommandEventHan dler(imageButto n_Command);
imageButton.Com mandName = "View";
container.Contr ols.Add(imageBu tton);
break;
}
}

void imageButton_Com mand(object sender, CommandEventArg s e)
{
if (e.CommandName == "View")
{
//can not use session or response.redire ct or how can I sent commandname up
to container user control or access other datagrid columns's data
}
}
Jul 21 '05 #1
0 999

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1738
by: Ex-Em-El | last post by:
I have a problem in creating a dynamic table in the same xml : 1.xml: <?xml version="1.0" standalone="yes"?> <?xml-stylesheet type="text/xsl" href="2.xsl"?> <aaa xmlns="http://tempuri.org/My.xsd"> <ppp> <po>
0
1351
by: JP011 | last post by:
Hello I have hit a major road block when it comes to building my dynamic datagrid. To make a long story short I need a dynamic datagrid because my connection string could change and I need the datagrid to handle that. First I tried to create my datagrid by leaving the auto-generate columns equal to true. This worked fine except that when my user wants to edit a line I do not want them to edit column 1, only column 2. I could not find a...
14
2244
by: Spare Change | last post by:
I am told that I can have a dynamic or static string array. So if I declare string dynamic; How do I add elements to dynamic and resize it ?
1
2248
by: Tommy Lang | last post by:
I am trying to learn to use dynamic variables. I have pasted the code below. Is this the proper way of using dynamic variables? Thanks, Tommy //------------------------------------------------------------ #include <iostream>
16
2137
by: laclac01 | last post by:
I have developed my own copy function for coping my own dynamic memory structure. It works, but I feel its not too efficient. There must be a quicker way to copy the data. In some of the routines I have developed the copy function gets called several hundreds of times, with very large data structures. This can take some time.... If you can't tell by the code the data structure is a matrix for storing complex numbers. Attached is...
1
7587
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a dropdown in UC1 _________________________ 1) MainPage_Load 2) User Control_1 Load
0
1700
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a single worksheet into a dataset. I successfully built a dynamic datagrid. And I did successfully bind it to the dataset. Then I added the datagrid control to a PlaceHolder. The first worksheet displays beautifully. The next step is to allow...
1
1835
by: benoit | last post by:
Hi, I created a Dynamic Datagrid and i added an EditCommandColumn to it. Works fine, but my Editcommand eventhandler seems to have a problem with PostBack This is my code private DataGrid GridDataLangs(DataTable vDataTable){ DataGrid myGrid = new DataGrid(); myGrid.AutoGenerateColumns = false;
7
3391
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always either AND or OR but never mixed together. We can use Northwind database for my question, it is very similar to the structure of the problem on the database I am working on. IF(SELECT OBJECT_ID('REPORT')) IS NOT NULL DROP TABLE REPORT_SELECTION
16
10330
by: pukivruki | last post by:
hi, I wish to create a temporary table who's name is dynamic based on the argument. ALTER PROCEDURE . @PID1 VARCHAR(50), @PID2 VARCHAR(50), @TICKET VARCHAR(20)
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9955
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9833
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7378
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.