Professional Web Applications Themes

Dynamic temp. datagrid col.gen. -Session access inside a class inside a UserCtrl - ASP.NET Data Grid Control

Hello Dear Professionals: Based on this doent: [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingwebservercontroltemplatesdynamically. asp[/url] or this [url]http://www.dnzone.com/ShowDetail.asp?NewsId=599[/url] 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 ...

  1. #1

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

    Hello Dear Professionals:
    Based on this doent:
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingwebservercontroltemplatesdynamically. asp[/url]
    or this [url]http://www.dnzone.com/ShowDetail.asp?NewsId=599[/url]
    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
    [email]andyeshtryhotmail.com[/email]


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


    Andy Eshtry Guest

  2. #2

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

    Hello Dear Professionals:
    Based on this doent:
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingwebservercontroltemplatesdynamically. asp[/url]
    or this [url]http://www.dnzone.com/ShowDetail.asp?NewsId=599[/url]
    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
    [email]andyeshtryhotmail.com[/email]


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


    Andy Eshtry Guest

Similar Threads

  1. How can I access a component inside a class file?
    By doug777 in forum Macromedia Flex General Discussion
    Replies: 3
    Last Post: July 3rd, 05:34 PM
  2. can i use dynamic variable inside a dataadapter and bind to datagrid
    By jijis in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: March 28th, 02:24 PM
  3. How to access the controls that are inside of a DataList/DataGrid using JS?
    By Renato Neves in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: May 17th, 01:24 PM
  4. Using class inside ASP
    By Utada P.W. SIU in forum ASP Components
    Replies: 1
    Last Post: February 24th, 10:01 AM
  5. #23038 [Com]: PHP does not detect parent class inside child class' constructor
    By hewei at ied dot org dot cn in forum PHP Development
    Replies: 0
    Last Post: August 6th, 02:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139