Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7767543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:42:15+00:00 2026-06-01T15:42:15+00:00

One of BoundField in my GridView has a very long string without space. I

  • 0

One of BoundField in my GridView has a very long string without space. I want to dispaly it correctly. According to the similar question.
I used the code

<asp:TemplateField HeaderText="ICD9" ItemStyle-Width="75px" SortExpression="ICD9" >
                        <ItemTemplate>
                            <div style="width: 75px; overflow: hidden; white-space: nowrap; word-wrap: break-word;">
                                <%# Eval("ICD9")%>
                                </div>
                        </ItemTemplate>
                    </asp:TemplateField>

Although it works, but when I switch it the Edit mode. The column can not be editted.The textbox doesn’t show up.

Thanks.
image

Please look at the second column, it may has a long string.(Right now it is “None”).
It can not be editted.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:42:16+00:00Added an answer on June 1, 2026 at 3:42 pm

    Inside your <TemplateField>, you also need an <EditItemTemplate>:

    <asp:TemplateField HeaderText="ICD9" ItemStyle-Width="75px" SortExpression="ICD9" >
        <ItemTemplate>
            <div style="width: 75px; overflow: hidden; white-space: nowrap; word-wrap: break-word;">
                <%# Eval("ICD9")%>
            </div>
        </ItemTemplate>
        <EditItemTemplate>
            <div style="width: 75px; overflow: hidden; white-space: nowrap; word-wrap: break-word;">
                <asp:TextBox ID="TextBox1" runat="server"
                Text='<%# Bind("ICD9") %>'></asp:TextBox>
            </div>
        </EditItemTemplate>
    </asp:TemplateField>
    

    This way, when your GridView goes into edit mode, it knows what to render for that field.

    Without being able to see your other fields, it’s possible they are working because they are simply <BoundField>s, which would have this behavior by default (when in the TemplateField, you have to explicitly define the edit and non-edit modes).

    You can take a look at this (sort of old) tutorial for more information on TemplateFields: Using TemplateFields in the GridView control

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One of BoundField in my GridView has very long string without spaces and it
I have one GridView gvDetail which has 30 columns(include both Template and BoundField). In
I have Two Labels such as FixedTotal and TotalPercent, One GridView which has One
I have a gridview with an ObjectDataSource which I want to update with one
I have a templated Gridview where I only want to display one column (Questions
I want to delete one particular row in Gridview. So I need ID, How
I have a gridview, with some columns. I want to hide one column, but
I have a very simple GridView on one of my pages with the following
I have one GridView which has multiple columns. Here I just mentioned only the
I currently have an asp:GridView that displays a few BoundFields and then one asp:TemplateField

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.