Label depends on field value - symfony-1.4

Hi is there chance that I can change field label depends on fields value
ex.
when is_active = 1 set label = Active
when is_active = 0 set label = In active
in yaml

Related

Text of the label not displayed in browser

i have assigned the value to the label from data table ,the value of label is shown when i checked using break point.But it not shown in the browser
if(loadingHubArrivalTable.Rows.Count > 0 && dt != Convert.ToDateTime("1900-01-01"))
{
//ReferenceLabel.Text = loadingHubArrivalAdapter.SelectReferenceNumber(Convert.ToInt32(VehicleDropDownList.SelectedValue)).ToString();
ReferenceLabel.Text = loadingHubArrivalTable.Rows[0]["ReferenceNumber"].ToString();
VehicleNumberLabel.Text = VehicleDropDownList.SelectedItem.Text;
//loadingHubArrivalTable.Rows[0]["VehicleNumber"].ToString();
ObjectDataSource1.Select();
CheckBoxList.DataBind();
}

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!).

Creating a label inside Gridview Cell from VB

I have some Code in VB that is looping through a gridview's rows and is checking the values of a certain collumn, I have written some code inside the if statement that creates a clickable label inside the cell for when the cell is "", I have already written a bit of code that could create my label but I'm not too sure how it would create it inside row.Cells(8)
I was wondering if could get some assistance with how I should be doing this?...
Here's my Code:
For i As Integer = 0 To GridView1.Rows.Count - 1
Dim row = GridView1.Rows(i)
Dim rowHeaderCell = row.Cells(8)
If rowHeaderCell.Text = " " Then
Dim lbl As New Label
lbl.Size = New System.Drawing.Size(159, 23)
lbl.Location =
lbl.Text = "label text goes here"
Me.Controls.Add(lbl)
End If
Next
Thankyou in advance!
To make a clickable label change the type of the column to : [DataGridViewLinkColumn]
here is the code to replace the Empty cell value by the value of LBL:
For i As Integer = 0 To GridView1.Rows.Count - 1
If GridView1.Rows(i).Cells(8).Value.Trim = "" Then
Dim lbl As String
lbl = "label text goes here "
GridView1.Rows(i).Cells(8).Value = lbl
End If
Next

adding editable CheckBoxField to gridview

I am trying programatically add a check box column to a grid view. This grid view has multiple other columns but I only want the check box column to be editable. The only examples I have seen require that I add an "Edit" link to each row. I would like for the check box column to be editable by default, without the need for a link. The check box should also support autopost backs. Anyone have any suggestions? Below is what I have so far:
Dim gv As New GridView
With gv
.ID = "gridViewFoundUsers"
.AutoGenerateColumns = False
.DataKeyNames = New String() {"UserId"}
.GridLines = GridLines.Both
.AllowSorting = True
.AllowPaging = True
.PageSize = numRows
.Width = tableWidth
.BorderColor = Drawing.ColorTranslator.FromHtml("#808080")
.AutoGenerateEditButton = True
.HeaderStyle.CssClass = foundUserHeadStyle
.RowStyle.CssClass = foundUserEvenRows
.Columns.Clear()
Dim UserIdTF As New BoundField
With UserIdTF
.DataField = "UserId"
.HeaderText = "UserID"
.SortExpression = "UserId"
.ItemStyle.Wrap = True
.ItemStyle.Width = 100
End With
Dim DomainTF As New BoundField
With DomainTF
.HeaderText = "Domain"
.DataField = "Domain"
.SortExpression = "Domain"
.ItemStyle.Wrap = False
.HeaderStyle.Font.Underline = False
End With
Dim SelectUserTF As New CheckBoxField
With SelectUserTF
.HeaderText = "Select User"
.ItemStyle.Wrap = False
.DataField = "isSelected"
End With
.Columns.Add(UserIdTF)
.Columns.Add(DomainTF)
.Columns.Add(SelectUserTF)
End With
The gridview is part of a composite server control, so there is no client side code pages.
Thanks!

Increasing Array Size dynamically

I have this array in ASP
CONST CARTPID = 0
CONST CARTPRICE = 1
CONST CARTPQUANTITY = 2
dim localCart(3,20)
I add items to this array dynamically like this
localCart(CARTPID,i) = productId
localCart(CARTPRICE,i) = productPrice
localCart(CARTPQUANTITY,i) = 1
The problem is, after 4 items, I can still add the items but UBound always return 3. Which causing my conditions failing.
I want to increase size of this array at run time so that UBOUND can return latest value.
Please let me know how can i do that. Here is my complete code
'Define constants
CONST CARTPID = 0
CONST CARTPRICE = 1
CONST CARTPQUANTITY = 2
'Get the shopping cart.
if not isArray(session("cart")) then
dim localCart(3,20)
else
localCart = session("cart")
end if
'Get product information
productID = trim(request.QueryString("productid"))
productPrice = trim(request.QueryString("price"))
'Add item to the cart
if productID <> "" then
foundIt = false
for i = 0 to ubound(localCart)
if localCart(CARTPID,i) = productId then
localCart(CARTPQUANTITY,i) = localCart(CARTPQUANTITY,i)+1
foundIt = true
exit for
end if
next
if not foundIt then
for i = 0 to 20
if localCart(CARTPID,i) = "" then
***ReDim Preserve localCart(UBound(localCart, 1) + 1,20)***
localCart(CARTPID,i) = productId
localCart(CARTPRICE,i) = productPrice
localCart(CARTPQUANTITY,i) = 1
exit for
end if
next
end if
end if
If your adding the items dynamically in a loop you'll want to use the Redim Preserve() statement. You'll want to use the Preserve part so you don't lose any of your existing data.
Otherwise if your using the array data and then redimming it for another set of data you can just the Redim() statement
Here is a good reference on using Redim() / Redim Prevserve() Statments: http://classicasp.aspfaq.com/general/can-i-create-an-array-s-size-dynamically.html
The first dimension is only 3 in length, while the second dimension is 20. If you want the UBound of the second dimension, do this:
UBound(localCart, 2)
Which returns 20. You should be able to combine this with ReDim Preserve.
I think redimentioning the array with the current UBound+1 after each addition of new item will make UBound gives you the latest value finally.
// New item addition code will go here
ReDim localCart(UBound(localCart, 1) + 1,20)
So it will update your array with the new size every time you will add the new item.

Resources