DataGrid Edit TextBox

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

  1. #1

    Default DataGrid Edit TextBox

    Hi NG.

    I'm having trouble controling the size of the textboxes that appear when the
    user clicks the "edit" button for a row in my datagrid.
    I know it can be done and I know it doesn't require much, but I just can't
    seem to find out how to anyway.

    If anyone could help me out with this little problem it would be much
    appreciated :)

    Thanks
    /Aidal


    Aidal Guest

  2. Similar Questions and Discussions

    1. Would like to load a datagrid already in edit mode instead of having the user click the edit button
      Now my asp.net datagrid shows an edit button and clicking it puts the datagrid in edit mode. I would like to: 1) possilby load the page already...
    2. Set the width of the edit textbox after clicking on Edit link in datagrid...
      Hi There, I have a data grid where I have a couple of columns as follows: ----------------------------------------- |id | textual...
    3. Textbox Font and Fontsize in Edit Mode
      How do I change the textbox font and fontsize in Edit Mode? Thanks, -Dave
    4. DataGrid ItemStyle is a textbox and doesn't update the datagrid datasource
      I have a datagrid with two columns, the first a normal bound column, the second is a template column created from a bound column. For the...
    5. Edit Datagrid - show textbox and dropdown
      Hi All, I have a problem trying to edit the data in a datagrid control. I have 2 bound columns in the datagrid. I have added the following code...
  3. #2

    Default Re: DataGrid Edit TextBox

    We'll help you, but what is the problem? All I got was that you wanted to control the size of the textboxes, but you'll need to be more specific than that.



    --------------------------------------------------------------------------------
    All that glitters has a high refractive index.
    [url]www.mendhak.com[/url]
    "Aidal" <aidatheonly@hotmail.com> wrote in message news:dkd5rn$jt1$1@pomoranche.gu.net...
    Hi NG.

    I'm having trouble controling the size of the textboxes that appear when the
    user clicks the "edit" button for a row in my datagrid.
    I know it can be done and I know it doesn't require much, but I just can't
    seem to find out how to anyway.

    If anyone could help me out with this little problem it would be much
    appreciated :)

    Thanks
    /Aidal


    S.M. Altaf [MVP] Guest

  4. #3

    Default Re: DataGrid Edit TextBox

    Umm..Hmm that's it more or less - I'm not sure what else there is to
    explain about it.

    I want to be able to control the size of the textboxes that appear when
    I click an 'Edit' button for a line in my datagrid.

    Currently they are too long (the default width) resulting in the
    datagrid becoming wider when a row is in edit mode and that doesn't look
    good.

    So I wan't to make sure that the width of the grid doesn't change once
    an 'edit' button is clicked.

    So that if this [----this width----] was the original size of a textbox
    when a row is in edit mode, the new version could be [-this width-].

    I hope this helps clearify what it is I mean.

    /Aidal



    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Aidal Theonly Guest

  5. #4

    Default Re: DataGrid Edit TextBox

    Hi, Aidal, you have two ways to do it. If you are using the BoundColumn, then
    you can set the width of textbox in the ItemCreated event.

    protected void dgrd_ItemCreated(Object sender, DataGridItemEventArgs e)
    {
    if(e.Item.ItemType == ListItemType.EditItem)
    {
    TextBox txt = (TextBox)e.Item.Cells[X].Controls[0];
    txt.Width = < the width you want it to be>;
    }
    }

    Another way is set the TextBox's width declaractively in the TemplateColumn.


    Hope this helps....
    alvinz_c 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