没有代码,你加上kepress属性在函数里用javascript就可以实现了

解决方案 »

  1.   

    请问如何加上kepress属性,如何用javascript实现呢,我还不是很熟,谢谢
      

  2.   

    用纯C#代码如下解决:
    SqlConnection conn = new SqlConnection("data source=edvac;uid=sa;pwd=sa;database=northwind");
    conn.Open();
    SqlDataAdapter da = new SqlDataAdapter("select CategoryID,CategoryName from Categories",conn);
    DataSet ds = new DataSet();
    da.Fill(ds,"Categories");
    DataGridTableStyle style = new DataGridTableStyle();
    style.MappingName = "Categories";
    DataGridColumnStyle CategoryID = new DataGridTextBoxColumn();
    CategoryID.MappingName = "CategoryID";
    DataGridColumnStyle CategoryName = new DataGridTextBoxColumn();
    CategoryName.MappingName = "CategoryName";//关键之处:
    DataGridTextBoxColumn nameColumn = (DataGridTextBoxColumn)CategoryName;
    TextBox nameTextBox = nameColumn.TextBox;
    nameTextBox.CharacterCasing = CharacterCasing.Upper;
    style.GridColumnStyles.AddRange(new DataGridColumnStyle[]{CategoryID,CategoryName});
    dataGrid1.TableStyles.Add(style);
    dataGrid1.SetDataBinding(ds,"Categories");
    conn.Close();这是我用northwind作为例子来做的,这一段是我写在检索按纽里的操作,当然也可以写在其它任何需要的地方
      

  3.   

    TextBox1.Attributes.Add("onkeypress", "javascript:event.keyCode=((event.keyCode>=97)&&(event.keyCode<=132))?(event.keyCode-32):(event.keyCode);");
      

  4.   

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchTopQuestionsAboutASPNETDataGridServerControl.asp