Hi all,
I am getting the subjected error when i execute the following code. can anyone guide me where is the error in this code.
private void SearchOnUserCodesAdapterShowDialog(string TypeID,Epicor.Mfg.UI.FrameWork.EpiUltraCombo Ctr) { // Wizard Generated Search Method // You will need to call this method from another method in custom code // For example, [Form]_Load or [Button]_Click UserCodesAdapter UserCodesAdapter = new UserCodesAdapter(oTrans); UserCodesAdapter.BOConnect();
bool avail = UserCodesAdapter.GetByID(TypeID);
if(avail) {
{ Ctr.ValueMember = "CodeID"; // Set EpiUltraCombo Properties if(TypeID == "RunningNum") { Ctr.ValueMember = "CodeDesc";
string str1 =""; DataRow row = this.edvProject.CurrentDataRow; if(row!=null) str1= row["ShortChar01"].ToString(); Ctr.DataSource = UserCodesAdapter.UserCodesData.UDCodes.Select("CodeID = '" + str1 + "'");
//MessageBox.Show(str1);
if(((DataRow[])Ctr.DataSource).Length>0) { //string[] strKey = new string[] //for(int i=0;i< UserCodesAdapter.UserCodesData.UDCodes.Rows.Count; i++) { UserCodesAdapter.UserCodesData.UDCodes.Rows[0]["CodeDesc"] = Convert.ToDouble(UserCodesAdapter.UserCodesData.UDCodes.Rows[0]["CodeDesc"]) + 1; } //Ctr.ValueMember = "CodeDesc"; // Ctr.DisplayMember = "CodeDesc"; //((DataRow[])Ctr.DataSource)[0]["CodeDesc"] = Convert.ToDouble(((DataRow[])Ctr.DataSource)[0]["CodeDesc"]) + 1; //MessageBox.Show(((DataRow[])Ctr.DataSource)[0]["CodeDesc"].ToString()); } } else if(TypeID =="DepIdent") { string str =""; DataRow row = this.edvProject.CurrentDataRow; if(row!=null) str= row["ShortChar01"].ToString(); Ctr.DataSource = UserCodesAdapter.UserCodesData.UDCodes.Select("Character01 = '" + str + "'"); }
else Ctr.DataSource = UserCodesAdapter.UserCodesData.UDCodes;
Ctr.DisplayMember = "CodeDesc"; string[] fields = new string[] {"CodeDesc"}; Ctr.SetColumnFilter(fields);
} } UserCodesAdapter.Dispose(); }
bool runningnum_selected = false;private void Project_BeforeFieldChange(object sender, DataColumnChangeEventArgs args) { // ** Argument Properties and Uses ** // args.Row["FieldName"] // args.Column, args.ProposedValue, args.Row // Add Event Handler Code switch (args.Column.ColumnName) { case "ShortChar04": runningnum_selected = true; break; } } private void edvProject_EpiViewNotification(EpiDataView view, EpiNotifyArgs args) { // ** Argument Properties and Uses ** // view.dataView[args.Row]["FieldName"] // args.Row, args.Column, args.Sender, args.NotifyType // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes // if ((args.NotifyType == EpiTransaction.NotifyType.AddRow)) // { if ((args.Row > -1)) { runningnum_selected = false; { SearchOnUserCodesAdapterShowDialog("RunningNum",cbxRunningNum); } //} } }}
Regards,
Akram
Just to give you a little more info... that error message indicates that there is a cell in the grid that is trying to convert the cell's value into something the cell editor can display and failing to do so.
The usually occurs when a cell is edited or assigned a value. But you seem to be saying that it happens when the grid displays or is bound without any user intervention.
The grid is pretty good about picking the correct editor based on the data type of the column in the data source. So if you are getting this error without editing a cell, it could be because you assigned an editor to a column and that editor is not appropriate for the data type of that column. Or, it could be that your data source is using a data type that the grid simply cannot support. As far as I know, the latter case has never happened, though, so that seems unlikely. The grid typically just falls back to displaying the ToString of the value if it doesn't recognize the data type.
Hi,
When i comment the code(cbxRunningNum.DropDownStyle = Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList;) for drop down style , i am not getting this internal error. whereas when i change the selection of division the running number should match that division, when i drop down it is appearing but, we can edit the combo also, it there any other way apart from (cbxRunningNum.DropDownStyle = Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList;) so that the combo is non editable.
please let me know if you dont understand my concern .
akram
Hi Akram,
akram khan said:When i comment the code(cbxRunningNum.DropDownStyle = Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList;) for drop down style , i am not getting this internal error
This says to me that you have a ValueList, Editor, or EditorControl applied to this column and the items on the list don't match the DataType of the column and that's why the grid is unable to convert the values.
So what is the DataType of the column and what are the DataTypes of the items in the list?
Hi Mike,
The data type of the combo is char and the datatype of the value list is char which is converted to double and displayed in value list.
((DataRow[])Ctr.DataSource)[0]["CodeDesc"] = Convert.ToDouble(((DataRow[])Ctr.DataSource)[0]["CodeDesc"]) + 1
Well, that's the problem, then. Why are you converting a char to a double? I'm pretty sure that C# will allow you to implicitly convert a char to an int and vice versa, but a char has no implicit conversion to a double.
There are a number of ways you could handle this. One way to do it would be to populate your ValueList such that each item has a DataValue (double) and a DisplayText (the char or string to display). That would handle the conversion for you, but you would have to populate the ValueList with every possible value.
Another way would be to use a DataFilter, but frankly, I'm not sure that would work with a ValueList and it would be a lot more complicated approach.
Could you please help me with the code. What to replace this code with ,
((DataRow[])Ctr.DataSource)[0]["CodeDesc"] = Convert.ToDouble(((DataRow[])Ctr.DataSource)[0]["CodeDesc"]) + 1.
Hi ,
Adding to that in my case the data value and display member both are number only , i want to display number itself.How could i acheive this.
You need to make sure that the items on the ValueList are the same type as the items in the grid column. So I think it would make more sense to change how you are populating the ValueList, as opposed to changing the data source list. Unless your ValueList is bound and the DataSource you are referring to here is what it's bound to?
It's very difficult for me to determine what you need to change since I don't know what your app is doing or what these objects are.
You originally said that the column contain chars - but now you are saying you want numeric values displayed?
Hi mike,
The data types of the fields are char only but i am populating a number field in the char field and converting to double +1; my application provides standard char fields only, that i why i am converting to double and adding.
((DataRow[])Ctr.DataSource)[0]["CodeDesc"] = Convert.ToDouble(((DataRow[])Ctr.DataSource)[0]["CodeDesc"]) + 1;
Hope you understand..
regards,