What control to use for display a row from Database - asp.net

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

Related

Add a search field by header using PeopleSoft

I’m looking to add search fields in each table header automatically using peoplesoft.
Example
Javascript solution:
add an html area to your page (with rec field)
assign via peoplecode an html object to the field
use something like this Javascript Filter on the table
For this to work well, your grid needs to show all rows and not paginate.
If it paginates and you need to keep the pagination, then you need to go for the PS solution:
Add one search field per header you want to search
On the fieldchange you perform a rowset flush then .Select(" WHERE ...") to populate it based on the filter

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.

XPages and Dojo Radio Buttons

I using some Dojo radio buttons in an XPages application and would like to display the label, not the selected value, when the XPage is in read mode. Is this possible? Here is an example of my code:
<xe:djRadioButton id="C1B1_R1" groupName="FKRadio1" value="#{document1.C1B1_RValue}">
<xe:this.label><![CDATA[#{javascript:sessionScope.get("C1B1_R1")}]]></xe:this.label>
<xe:this.selectedValue><![CDATA[#{javascript:sessionScope.get("SV_C1B1_R1")}]]>
</xe:this.selectedValue>
<xe:this.rendered><![CDATA[#{javascript:var r3 = sessionScope.get("C1B1TextVisibility");
#If(currentDocument.isEditable(),#If(r3 != null && r3[0]!=0,true,false),
#Trim(#GetField("C1B1_RValue")) == sessionScope.get("SV_C1B1_R1"), true, false)}]]>
</xe:this.rendered>
</xe:djRadioButton>
In edit mode, the labels are displayed. However in read mode, the value of the field is displayed rather than the corresponding label for the field value. In this case, the values are all numeric while the labels are text.
Tony,
Three things that you should try, these are written in order you should try:
1) I think it is rendering as just plain text when in read mode, so it just shows the values. Try setting the "Show disabled control for read only" and see if it renders it as something other than plain text.
2) Change the code to be the same for read or edit mode, in other words make it like edit mode. Then use the styleClass to use jQuery or CSS to restrict editing.
3) Use a hidden input/display:none to load the field on the page, then set the label to a field that is shown
You can hidde the djRadioButton in read mode, and show a xp:text with the label instead.
Or, maybe with the property "Show disabled control for read-only" (in general properties of the Dojo Radio Button)

ASP.Net Code Optimization

I have almost every piece of code, I just need it to be optimized using correct IF_ELSE conditions and arranging the right flow.
I have a webform (UserProfile.aspx), which contains FormView (to display user profile).
In FormView ItemTemplate, I have put simple HTML and ASP.Net Labels to display Info using Label's Text property :
Eval("col_name");
In EditItemTemplate, I have same table with but textboxes instead of Labels.
I have a button "Edit", on its Click event, I'm changing FormViewMode
FormView1.changeMode(FormViewMode.Edit); [ WORKING ]
I have another button "Cancel", on its Click event, I'm changing FormViewMode
FormView1.changeMode(FormViewMode.ReadOnly); [ <-- NOT WORKING ]
To display user profile, I'm passing user-id from querystring (querystring field = "user")
So the valid URL looks like :
/UserProfile.aspx?user=121
What I want to achieve is :
If (user_IS_Logged_In)
//Some basic tasks like setting welcome message label with username/email etc.
If (querystring_is_EMPTY OR querystring_field_is_incorrect OR user_IS_NOT_Logged_IN)
//Remove the Edit and Cancel buttons
If (querystring_field_is_exist)
//initialize user_id (this will be passed to ShowUserDetails(user_id))
If (user_IS_Logged_In AND querystring_is_exist)
If querystring value and logged in user_id ARE NOT EQUAL THEN
//Again Remove the Edit and Cancel buttons
P.S --> I'm thinking to add an UpdatePanel around the FormView Once I achieve above tasks, for consistent look.
I know the problem is quite difficult to understand so feel free to ask details.
I will provide the code as needed.

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'];

Resources