Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Autocomplete function for datagridview
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 3.0
OS:
Windows Server 2003
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01429055
Message ID:
01433232
Vues:
37
>Linda,
>
>>I got this to work as described at that site. It suggests creating an AutoCompleteStringCollection variable at the form level, which I will call acsTest. Then, the code below is loaded in the EditingControlShowing event of the grid.
>
>Glad to hear it worked for you!
>
>>It seems like you also ought to be able to set the AutoComplete values after the form's InitializeComponent() so it just executes once, rather than each time you enter the cell in the grid but I'm not having good luck getting a reference to the control in the grid. I thought the Controls collection might let me do that but it only has 3 controls at startup. Is there some other place I can get that reference?
>
>Here is some code from MM .NET's mmGridView.BindBack() method that shows how to access cells in a GridRowView that may help you out:
>
>
GridViewRow item = this.Rows[this.EditIndex];
>
>int CellNumber = 0;
>
>foreach (TableCell cell in item.Cells)
>{
>	// Need to check HasControls because if a column is set to ReadOnly,
>	// HasControls() returns false. Trying to process the controls collection
>	// when HasControls() is false, throws an exception.
>	if (cell.HasControls())
>	{
>		DataControlField column = this.Columns[CellNumber];
>
>		BoundField BoundCol = column as BoundField;
>		if (BoundCol != null)
>		{
>			TextBox TxtBox = cell.Controls[0] as TextBox;
>			if (TxtBox != null)
>			{
>				mmReflection.SetPropertyValue(entityList[this.EditIndex], BoundCol.DataField, TxtBox.Text);
>			}
>			else
>			{
>				CheckBox ChkBox = cell.Controls[0] as CheckBox;
>				if (ChkBox != null)
>				{
>					mmReflection.SetPropertyValue(entityList[this.EditIndex], BoundCol.DataField, ChkBox.Checked);
>				}
>			}
>		}
>	}
>	CellNumber++;
>}
Thanks, Kevin. This looks like it may let me do that. I'm going to give it a try.
Linda Harmes
HiBit Technologies, Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform