C# devexpress lookupedit Colums get the value - devexpress

Lookupedit editvaluechange event BirimFiyat Colums get the value ?
Lookeditup load
AnlasmaKalemleri.Properties.DataSource = WinTools.TabloParametre("SP_ANLASMA_COMBO", "#PROJEID",
"#FÄ°RMAID",
PROJEIDLookUpEdit.EditValue.ToString(), FÄ°RMAIDLookUpEdit.EditValue.ToString());
AnlasmaKalemleri.Properties.DisplayMember = "TANIM";
AnlasmaKalemleri.Properties.ValueMember = "ID";
Birimfiyat get the value ?

Related

Devexpress RespositoryLookUpEdit in grid , the value disaper

I have a devexpressgridcontrol. I want to use in one column of the grid : repositoryLookUpEdit.
I fill repositoryLookUpEdit with database question.
This question return three columns : IdPerson , Name and IdCity. Colums : IdPerson and Name have data but IdCity I have to set in appication.
So
- in gridcontrol the column Idcity has fildename : IdCity, and columnEdit : repositoryLookUpEdit.
- repositoryLookUpEdit has DisplayValue : CityName, and ValueMember: IdCity.
And my question is:
When I choose in grid in one row value of city and I go to another row, the value from the first row disaper.
What am I doing wrong? Could you give me some advise?
I use Devexpress 9.2.
this.gvPerson = new DevExpress.XtraGrid.Views.Grid.GridView();
this.replueCity = new DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit();
this.replueCity.Columns.AddRange(new DevExpress.XtraEditors.Controls.LookUpColumnInfo[] { new DevExpress.XtraEditors.Controls.LookUpColumnInfo("IdCity", "IdCity", 20, DevExpress.Utils.FormatType.None, "", false, DevExpress.Utils.HorzAlignment.Default), new DevExpress.XtraEditors.Controls.LookUpColumnInfo("CityName", "CityName")});
this.replueCity.DisplayMember = "CityName";
this.replueCity.Name = "replueCity";
this.replueCity.NullText = "[Choose city]";
this.replueCity.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
this.replueOceny.ValueMember = "IdCity";
// CityColumn this.CityColumn.AppearanceCell.Options.UseTextOptions = true;
this.CityColumn.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.CityColumn.AppearanceCell.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
this.CityColumn.Caption = "Ocena";
this.CityColumn.ColumnEdit = this.replueCity;
this.CityColumn.FieldName = "IdCity";
this.CityColumn.Name = "IdCityName";
this.CityColumn.Visible = true;
You have to set ValueMember for replueCity (which is the editor in the column). You set it only for replueOceny.
Check string IdCity in all three cases: it must be written exactly the same (mind the caps!).

How to set label value when databinding asp.net chart control

I am binding a datatable to an asp.net chart but want to set the value of the label to a different dataitem (called ResLabelText) than used for the x or y axis. Can this be done? My databinding code is as follows:
chartRes.Series("Month").XValueMember = "MonthName"
chartRes.Series("Month").YValueMembers = "Res"
chartRes.Series("Month").Label = "ResLabelText"
chartRes.Series("Month").ToolTip = "#VALX"
chartRes.DataSource = dt
chartRes.DataBind()
Correct way:
For Each row In dt.Rows
Dim point = New DataPoint()
point.SetValueXY(row.Item("MonthName"), row.Item("Res"))
point.Label = row.Item("LabelRes")
point.ToolTip = row.Item("MonthName")
chartRes.Series("Month").Points.Add(point)
Next

How to select a particular data from a datatable?

I have three select statements,
select 1 from tbl1;
select 2 from tbl2;
select 3 from tbl3;
and in my front end i use a Datatable to retrieve the value from sql.
datatable dt = new datatable(); dt = obj.funcgetval();
gridview.DataSource = dt; gridview.Databind();
I want to select a particular data from the datatable like in a dataset we use ds.tables[0], how can we apply the same in a datatable?
You can use combination of Rows and Columns to read / write particular cell of datatable.
dataTable.Rows[rowsIndex].Column["ColumnName"] = "SomeValue";
string strValue = dataTable.Rows[rowsIndex].Column["ColumnName"].ToString();
To iterate through dataTable
foreach(DataRow row in dt.Rows)
{
string name = row["name"].ToString();
string description = row["description"].ToString();
}
If you want to select any row then use
DataRow dr=dt.Rows[Rowindex];
If you want to get any column value then
object obj=dt.Rows[Rowindex][columnindex];
or
object obj=dt.Rows[Rowindex]["ColumnName"];
This should work for you:
dt.Rows[rowindex]["ColumnName"].ToString();
If you want select specific cell value from Datatable,you can use..
dt.Rows[row index]["Column name"].TOString();
like if you want to select 1st row value from column say Name then use
dt.Rows[1]["Name"].TOString();
if u want select particular row itself you can use Select with filtercondition.
string FilterCond = ur condition;
DataRow[] myrow = dt.Select(FilterCond);

C# datagrid each column width based on percent of total? asp.net

I have a DataGrid that's being populated with the code below, the code below makes the overall grid the size I want but it does set the column width. What I want to do is be able to say hey there is 'x' columns in a datatable and my tablewidth is 'xInt' divide xint by 'x' columns (which i've done, i'm just not sure have to set the column width...)
Thanks!
int tableWidth = 650;
int columnCount = dtTable.Columns.Count;
int columnWidth = Math.Abs(tableWidth / columnCount);
SupportContacts.ItemStyle.Wrap = true;
SupportContacts.Width = tableWidth;
SupportContacts.DataSource = dtTable;
SupportContacts.DataBind();
You could try the following (although I'm not sure if it will let you when you are auto-generating your columns).
foreach( DataGridColumn c in SupportContacts.Columns)
{
c.ItemStyle.Width = Unit.Point(columnWidth);
}

How to get value of cells from DataTable

i got a select query that returns one row.
here is my DAL function:
public Test.RequestsDataTable getRequestById2(int rid)
{
RequestsTableAdapter adapter2 = new RequestsTableAdapter();
Test.RequestsDataTable dt2 = adapter2.GetData(rid);
return (dt2);
}
Test.xsd is tableAdapter.
my question is how do i call it from code behind file and get each cell value and store it in textbox.
It's a method. Call it.
It returns a Test.RequestsDataTable. If your table has columns Column1 and Column2, then you can do:
var dt = getRequestById2(123);
string col1 = dt.Column1;
int col2 = dt.Column2;
If that doesn't answer your question, then you need to be more clear in your question.
i wrote it in cs file:
Test.RequestsDataTable rdt = new DalObj().getRequestById2(111);
rdt.Columns[0] -> returns DataColumn so i defined
DataColumn c1 = rdt.Columns[0];
but i get the column name and not it's value.

Resources