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.

Please look at the second column, it may has a long string.(Right now it is “None”).
It can not be editted.
Inside your
<TemplateField>, you also need an<EditItemTemplate>:This way, when your
GridViewgoes 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