Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Control ID

    Folks

    I want to call a vbscript function from a dynamically created template edit
    control but I am having trouble with autogenerated control ID I set
    control.ID = "X" but when its rendered it has become grid:ctrl12:X or
    something.
    How can I get round this issue. I either need to be able to set it and
    datagrid not to change it or get the generated one.
    I set the call in OnDataBinding event eg

    public void OnDataBinding(object sender, EventArgs e)

    {

    TextBox t = (TextBox) sender;

    DataGridItem container = (DataGridItem) t.NamingContainer;

    object val = ((DataRowView) container.DataItem)[colname];

    if (val == null)

    t.Text = "";

    else

    t.Text = val.ToString();

    t.ID = "DateCol";

    string id = t.ID.ToString();


    // t.Attributes.Add("onchange","ConvertDate(" + "grid__ctl12_DateCol" +
    ".value)");

    t.Attributes.Add("onchange","ConvertDate(" + "DateCol" + ".value)");



    Any help most welcome.



    Eddie


    Eddie Celebi Guest

  2. Similar Questions and Discussions

    1. Possible to create a composite control that has a child control that is a validator that validates the composite control itself?
      I am attempting to create a composite control which has a label, followed by an optional error message, followed by two text boxes. I have...
    2. Composite control delegating databound templated features to child <asp:repeater> control
      Hi Everybody, I'm creating a composite control in C# that basically renders a bunch of webcontrols such as <asp:Label />, <asp:Repeater />,...
    3. Page Load fired 3 times Web user control is embedded in a custom control
      Hi, I have built a custom control that build a table with 3 cells in it. The custom control is designed to add all child controls to cell#2,...
    4. ControlDesigner not invoked on custom control when control is rendered within another custom control
      I have a custom control that has a simple designer (derived from System.Web.UI.Design.ControlDesigner) associated with it (using the...
    5. Using Table control in a custom composite control. Control does not render properly in design time.
      All, I have written a very simple custom composite control that includes a control of type System.Web.UI.WebControls.Table. The control...
  3. #2

    Default Control ID

    Is it possible to reset the counter of the automatic id generator of the
    ControlCollection?
    When I add a Control to a new ControlCollection it recive the id "ctl1", if
    the ControlCollection is cleared, the automatic counter won't be reset and
    the next added control recive the id "ctl2".


    Zürcher See Guest

  4. #3

    Default RE: Control ID

    hi,

    any reason as to why u need to reset the counter,
    You can assign an ID to the control at design time.
    Dont implement the inaming container interface to prevent prefixing the
    controls with "ctlxxx".

    regds,
    Kannan.V

    "Zürcher See" wrote:
    > Is it possible to reset the counter of the automatic id generator of the
    > ControlCollection?
    > When I add a Control to a new ControlCollection it recive the id "ctl1", if
    > the ControlCollection is cleared, the automatic counter won't be reset and
    > the next added control recive the id "ctl2".
    >
    >
    >
    Kannan.V [MCSD.net] Guest

Posting Permissions

  • You may not post new threads
  • You may 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