Results 1 to 3 of 3

Thread: Setting ASP.NET Textbox width to datagrid columns width

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Location
    Reading
    Posts
    70

    Setting ASP.NET Textbox width to datagrid columns width

    Hi,

    I'm using a datagrid to edit\update content on a database. This is good, but certain column have to be hyperlinks. When I do this and hit the edit command it doesn't replace it with a text box.

    I got round this by

    <asp:TemplateColumn HeaderText = "HYPERLINK">
    <ItemStyle Wrap="False"></ItemStyle>
    <ItemTemplate>
    <asp:hyperlink Runat = server NavigateUrl = <%#DataBinder.Eval(Container.DataItem, "HyperLink")%> text =<%#DataBinder.Eval(Container.DataItem, "HyperLink")%> ></asp:hyperlink>
    <asp:TextBox Runat = server text = <%#DataBinder.Eval(Container.DataItem, "HyperLink")%> Visible = false></asp:TextBox>
    </ItemTemplate>

    In my edit command procedure, I set the Hyperlink's visible property = false and the textboxe's = true.

    What I would like to do is set the textbox's width = to the parent column's width, I don't know the parent columns width at design time.

    Anybody got any ideas.

    Cheers,

    AuldNick

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Can't you just set the width to 100%?

    BTW - There is a forum specifically for ASP.NET questions.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Location
    Reading
    Posts
    70
    No I've tried the 100% idea, it doesn't have any effect. I'll try reposting on the ASP.NET forum. Cheers

Posting Permissions

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



Click Here to Expand Forum to Full Width