开发者

Cannot enter dot in a textbox

In my grid view i have link type column. as we cannot edit cell of such type i am displaying a text box if 开发者_如何学运维user select cell for editing. but my text box is unable read dot character. I checked "key pressed" and "text changed" events but events are not triggered for dot as a input.

EDIT: I can enter any character or symbol except dot.. ;(

I am displaying textbox on cell click event of gridview

if (DataGrid.Columns[e.ColumnIndex].GetType().Name == "DataGridViewLinkColumn")
{
txt_Data.Location    =   DataGrid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location;

txt_Data.Size        =   DataGrid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Size;

txt_Data.Visible     =   true;
txt_Data.Focus();
}

And assigning a value to cell as

private void txt_Data_TextChanged(object sender, EventArgs e)
{
  DataGrid.CurrentCell.Value = txt_Data.Text;
}


I had this problem a few days ago and it was driving me nuts.. Finally figured it out so I've come back here to enlighten :) The problem is the EditingControlWantsInputKey method for your editing control.. Make sure it returns true for all characters (or at least the characters you want to support).. Done! :D

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜