I have a grid where one column is a column of hyperlinks. How can I set the field labels to display the field's value, while keeping the column's label fixed?
You do this in two steps
set the Grid Column Label
For each row in the grid assign a value to the label of the field associated with the button
Ensure on the page that you have set the page field value for the grid and for the hyperlink column
The example below assumes the field associated with the hyperlink is SELECT_BTN. The column heading will be set to "My Column Title" and the hyperlink on the button will be set to the value of the DESCR field on same record.
Local Grid &grid;
Local GridColumn &hyperlinkColumn;
Local integer &i;
Local Rowset &rowset;
/* set the column header */
&grid = GetGrid(%Page, "MYRECORD");
&hyperlinkColumn = &grid.GetColumn("SELECT_BTN");
&hyperlinkColumn.Label = "My Column Title";
&rowset = GetLevel0()(1).GetRowset(Scroll.SOMERECORD);
/* Set the value for each hyperlink in the rowset */
For &i = 1 To &rowset.ActiveRowCount
&rowset(&i).SOMERECORD.SELECT_BTN.Label = &rowset(&i).SOMERECORD.DESCR.Value;
End-For;
Related
I created some Hash tables that will be used to fill text boxes. I want to access the Hash table with a variable that was selected from a list box.
$Dallas =#{
Address = "I20"
City = "Dallas"
State = "TX"
Zip = "75300"
}
I have a combo box with a list of city's
$myCity = $comboCity.Text
write-host $myCity "shows the city you selected"
I know that "$Dallas.Address" will show 120 but "$myCity.Address" is not a valid choice
My question is how do I make "$myCity" equal to the Hash table $Dallas?
In the project I am working in there is webpage which retrieve data from the database. So I have used DataGrid show my data.
But sometimes I wanted to add more columns to the DataGrid.That means I want to add some columns with data dynamically.
However I have new columns addition to the DataGrid and here is my code.
DataGridColumn myCol = new BoundColumn();
myCol.HeaderText = "Test";
myCol.Visible = true;
grdHeiskort.Columns.Add(myCol);
In here "grdHeiskort" is DataGrid ID.Now I want to add the data to this column named="test".That data is gain from the database.Suppose I am retrieving dataset from DB and I want to add the data in 1st column in dataset to my "test" column.So how can I do it.
If you use a BoundColumn you can set the name of the DataField to whatever the name of the field you want it to be from your dataset:
BoundColumn myCol = new BoundColumn();
myCol.HeaderText = "Test";
myCol.Visible = true;
myCol.DataField = "NameOfYourDataColumn";
grdHeiskort.Columns.Add(myCol);
A gridCoumn is defined in a Devex Xtra GridControl(winform type).
This column has two properties set :
FieldName --> a field name of a column in dataSource. OptionType
ColumnEdit --> as a RepositoryItemCombobox object , this object's 'Items' properties is having two value : Option1 , option2 & option3.
When data is set at runtime , the GridColumn shows the respective values in 'OptionType' column.
But now i cant change the values in any combobox of this column to other option by using the dropDown.
What am i missing ?????
I have a GridView and I want to refresh a row (not the whole grid) when it gets selected. I tried to change Text property for each of GridView.SelectedRow.Cells when Grid selected index changes. It seems to work for DataField, but not for TemplateField. For TemplateField I got strange results - the value for selected row changes properly, but when I select another row, the value of TemplateField for previously selected row becomes blank. Brief illustration :
1. Nothing selected
--------------------------
id template_field
--------------------------
1 value_1
2 value_2
2. First record selected
--------------------------
id template_field
--------------------------
1 updated_value_1
2 value_2
3. Second record selected
--------------------------
id template_field
--------------------------
1 [blank!]
2 updated_value_2
Eventually, I end up with blank template_field for each record except selected. What is the proper way to change the text of TemplateField ?
Try adding a TextBox control to your template, and change it instead of the cell contents. You should be able to get at it via something like this:
TextBox tb = GridView.SelectedRow.Cells[0].Controls[0] as TextBox;
if(tb != null)
tb.Text = newValue;
I m using a dropdown to display "Location" field of a table. I want to set first item of dropdowm as "-Select Location-". I can't set tables first record as "Select" because table is stroed in xml format. And table file is generated dynamicaly.
I am currentaly using as
ddlLocationName.Dispose();
ddlLocationName.AppendDataBoundItems = true;
ddlLocationName.Items.Add("Select Location");
ddlLocationName.DataSource = _section.GetLocations();
ddlLocationName.DataBind();
ddlLocationName.AppendDataBoundItems = false;
but data is binded repeatedly.
What will be the solution for this problem?
Thaks in advance.
After you have databound, then call ddlLocationName.Items.Insert(0, "Select Location");
Example:
ddlLocationName.Items.Clear();
ddlLocationName.DataSource = _section.GetLocations();
ddlLocationName.DataBind();
ddlLocationName.Items.Insert(0, "Select Location"); // Adds the item in the first position
Access the items in the form of ListItems:
ListItem li = new ListItem("Select Location","-1");
ddlLocationName.Items.Add(li);
After you have bound your other data, use:
ddlLocationName.SelectedValue = "-1";
Also, you can add the values of your table in similar way to the ListItem first.