Sorting item template when programmatically add HeaderText - asp.net

I have datagrid and inside this grid have template field. I add Header text progr. like this
gvData.HeaderRow.Cells(8).Text = "Hi"
But when I do this I can not sort this column when add SortExpression="Hi", i not have clickable header.
How can I do this
Tnx

I solve this with CType(gvData.HeaderRow.Cells(8).Controls(0), WebControls.LinkButton).Text

Related

Change column label on grid (PeopleSoft)

I'm having problems changing the label of a column on a PeopleSoft grid.
I have this code on the RowInit event of the main record:
Local Grid &Grid;
Local GridColumn &Column;
&Grid = GetGrid(Panel.V91MG_BI_INGMAN, "GRID");
&Column = &Grid.GetColumn("DATO_01");
&Column.Label = "Test";
The grid is composed of a Table record and a Derived/Work record. I need to rename the columns of the Derived record.
This is how the page looks like on designer view:
When I test my page, I receive the following message:
I know the grid is being set correctly, as I can change its label using &Grid.Label = "Hi".
Thanks in advance!
Your peoplecode is correct so far. You should move this code to the page activate event.
Did you set the page field name for this column?
If you want to change label only you can do same without writing code.
Go to page fields properties.
Select tab 'Label'
Select Text Radio and enter column label.

Drupal select list key in template file

How would I go about getting the key of a select list field in a view template (Row style output)?
The field is added to my view and hidden from display. It contains stuff like:
red|Red
green|Green
blue|Blue
How can I get the selected key (ie. red) for the field in the template?
I was able to print it using:
$view->field['field_color']->view->result[0]->field_field_color[0]['raw']['value']
but I wonder if there is an easier way to get that key.
Thanks in advance.
$row->field_field_color[0]['raw']['value'];

What control to use for display a row from Database

I have something like this
select sum(value) from database.table
And this will display only one number for example : 6546.00
What is the best control that i should use to display the selected data to my .aspx page
I don't want use DatagridView .
I think : label , textbox(onlyRead) , ListVIew or something else ?
If you just want to show the info then just use Label
If you want to Edit and Update the Info then just use Text
box..
If you have more than one info to show then just use Listview..
choice depends on your need..
But for displaying single value on screen then Label is best

How do layout how items are shown in asp gridview?

I'd like to change the way gridview shows its items according to the format below.
<img1> <img2> <img3> <img4>
<caption1> <caption1> <caption1> <caption1>
<img5> <img6> <img7> <img8>
<caption5> <caption6> <caption7> <caption8>
and so on...
You can use custom formatting options with the DataList or Repeater controls instead of a GridView. Check these examples for help :
http://csharpdotnetfreak.blogspot.com/2009/05/aspnet-creating-shopping-cart-example.html.
http://www.asp.net/web-forms/tutorials/data-access/displaying-data-with-the-datalist-and-repeater/formatting-the-datalist-and-repeater-based-upon-data-vb
Set AutoGenerateColumn property of gridview to false and then use <asp:TemplateField><ItemTemplate> under <Columns> section to add controls the way you like.

Peoplecode to hide column from a grid

I am trying to hide a Column from a grid using Peoplecode, but the column comes from a subpage. I tried using the following code.
GetGrid(Page.PAGE_NAME, "GRID_NAME").GetColumn("COLUMN_FIELDNAME").Visible = False;
This didnt work. Can anyone help me with this.?
Use the name of the parent page and not the subpage in the GetGrid call. The code should be on the Activate event of the parent page.

Resources