The GridView cell limits that users can only edit Chinese characters. The gridview Cell
The results are as follows:
The source code is as follows:
How can a cell in the gridView be controlled? Up to 20 Chinese characters can be entered
1. In cs code: In the RowDataBound of the GridView, Remove () string is truncated for the item to be processed.
2. On the aspx page, the <ItemTemplate> data item template tag of the GridView binds Eval to the attributes of the text displayed in the control, and uses SubString as the final part to capture and display the text.
For example:
<Asp: TemplateField HeaderText = "Description">
<ItemTemplate>
<Asp: Label ID = "lbl" runat = "server" Text = '<% # Eval ("Description"). ToString ()> 12? Eval ("Description "). toString (). remove (10) + "... ": Eval (" Description "). toString () %> '> </asp: Label>
</ItemTemplate>
</Asp: TemplateField>
Can the gridview achieve this effect? Assignment during cell double-click
Yes.
When binding each row in the databound event of the gridview, you can add the specified event to the cell that follows.
Similar
Protected void gvRefList_RowDataBound (object sender, GridViewRowEventArgs e)
{
If (e. Row. RowType = DataControlRowType. DataRow)
{
Label lbl_comp = e. Row. FindControl ("lbl_comp") as Label;
Lbl_comp... Attributes. Add ("","");
}
}