en_lang.jpg, 1 kB sk_lang.jpg, 1 kB
English Slovak

      Px Framework - ASP.NET components for rapid development of database applications


Menu:



Components of Px Framework:


PxRadioButtonList - component for view and selection of a value from the list



The PxRadioButtonList component has many similar properties as the PxEdit component.
Therefore, it makes no sense to decribe them in details, you can read the chapter on PxEdit component.
Things that were described in detail when dealing with the PxEdit component, we will pass here only by telegraph, briefly.

With the help of the PxRadioButtonList component we can automatically edit the column of the row in the table which is stretched in the PxWebQuery component.
We create AddAdresar.aspx file and the following definition of the PxRadioButtonList component into it:

AddAdresar.aspx file:

<Prx:PxRadioButtonList ID="rblCar" runat="server" AddTableRow="false" CaptionOnTop="True"   Width="150" />


In the file AddAdresar.aspx.cs we define the connection of the PxRadioButtonList component with the PxWebQuery component , and its link to a specific column in the table.

AddAdresar.aspx.cs file:

protected void Page_Load(object sender, EventArgs e)
{
   rblCar.PxDataSource = wquAdresar;
   rblCar.FieldName = "Z_COLOR";
}


The PxRadioButtonList component supports automatic loading of the value from the parameter of the PxWebQuery component and automatic storage of the selected value into the database when the command Post() on the PxWebQuery component is executed.
The PxRadioButtonList component enables selection of only one item from the list, therefore it is possible to specify on the PxWebQuery component how these conditions are displayed and entered into the database.
The parameter with the name of the method AddParamRadioList is used for definition.
The AddParamRadioList method is a method of the PxWebQuery component.


Description of the parameters of the AddParamRadioList method:
C# syntax:

public void AddParamRadioList(string aFieldName, string aDataKey, string aDataValue, string aFieldToView, string aFieldToDB)


Description of the parameters:

aFieldName - name of a column in the table on which method AddParamRadioList is applied.
aDataKey - name of the column in which a string of keys separated by semicolons is entered, in this case is "1;2"
aDataValue - name of the column into which a string of values is entered separated by semicolons in the same order as the key values have been entered. In this case it is "Red;Blue". This text will be displayed also in individual buttons in the PxRadioButtonList component
aFieldToView - the name of the column which value will be diplayed will be displayed in the Grid (PxSuperGrid),in this case the text "Value" and "Key".
aFieldToDB - the name of the column which value will be entered into the database is entered here, in this case the text "Value" and "Key".


Example of entry in the AddAdresar.aspx.cs file in the Page_Load method:

wquAkcia.AddParamRadioList("Z_COLOR", "1;2", "Red;Blue", "Value", "Key");


After the imposition of the parameter AddParamCheckList to the PxWebQuery component and connection of the component PxCheckBoxList, this component can automatically load data from the parameter and the selected value is automatically saved into the database.

Image components PxRadioButtonList


The AddTableRow, TableBegin and TableEnd properties, which are described in detail in the section dealing with the PxEdit component, are used once again for the alignment of the components.

Caption name or titles of the columns in the Grid (Title) can be defined centrally, during the definition of the PxWebQuery component, where the value in square brackets is the name of the column:

wquAdresar.Columns["Z_COLOR"].Caption = "Color a Name:";


Changing the PxRadioButtonList (Label) caption:
Besides central definition, the PxRadioButtonList component caption can be changed in the following way:

rblCar.Caption = "Color a Name 2";


If we want to place the caption of the PxRadioButtonList component over the component body (as it is shown in the image above), we use the property CaptionOnTop, the example below:

rblCar.CaptionOnTop = true;


The PxRadioButtonList component was also equipped with a reset button that is activated by setting the ThreeState property to "true". The reset button is used to reset the contents of the PxRadioButtonList component.

rblCar.ThreeState = true;


The PxRadioButtonList component with the reset button is shown in the picture below.

Image components PxRadioButtonList - reset button





Others articles of Px Framework:



It doesn't the intention of this part website, describe in detail the work with PxFramework components, a detailed description of the component available in manual, which can be downloaded here: Download manual of Px Framework