Skip to main content

ASPxClientHiddenField.Get(propertyName) Method

Returns the value with the specified property name.

Declaration

Get(
    propertyName: string
): any

Parameters

Name Type Description
propertyName string

A string value that specifies the property name.

Returns

Type Description
any

An object that represents the value of the specified property.

Remarks

The Get property is used on the client side to obtain the value with the specified property name from the control’s value collection.

To add a new value to the control’s collection of property name/value pairs on the client side, the ASPxClientHiddenField.Add or ASPxClientHiddenField.Set method can be used. To delete all values from the control’s collection of property name/value pairs, use the ASPxClientHiddenField.Clear method. An individual property name/value pair can be removed from the collection by using the ASPxClientHiddenField.Remove method.

Items from the control’s collection of property name/value pairs can also be manipulated on the server side by using the following methods: ASPxHiddenField.Add, ASPxHiddenField.Set, ASPxHiddenField.Get, ASPxHiddenField.Item, ASPxHiddenField.Clear, ASPxHiddenField.Remove.

Example

The following part of the ASPxHiddenField online demo illustrates how to manipulate the ASPxHiddenField items collection on the client and server side by using the ASPxClientHiddenField.Get, ASPxClientHiddenField.Set, ASPxHiddenField.Item property etc.

...
var viewsCount = 3;
function ShowPrevPage(){
    ChangeActiveViewIndex(-1); 
}
function ShowNextPage(){
    ChangeActiveViewIndex(1);
}
function ChangeActiveViewIndex(changeIndex){
    hfAnswers.Set("questionIndex", GetQuestionIndex() + changeIndex);
    cpVoting.PerformCallback();
}
function GetQuestionIndex(){
    return hfAnswers.Get("questionIndex");
}
function IsPreviewPage(){
    return GetQuestionIndex() == (viewsCount - 1);
}
function OnSeasonChanged(s, e){
    hfAnswers.Set("month", 0);
    hfAnswers.Set("season", s.GetSelectedIndex());
}
function OnMonthChanged(s, e){
    hfAnswers.Set("month", s.GetSelectedIndex());
}
...
<script runat="server">
...
     private void LoadPreview() {
         int seasonIndex = (int)hfAnswers["season"];
         int monthIndex = (int)hfAnswers["month"];
         lblSelectedSeason.Text = seasons[seasonIndex];
         lblSelectedMonth.Text = months[seasonIndex][monthIndex];
     }
...
 </script>

...
 <dxhf:ASPxHiddenField runat="server" ClientInstanceName="hfAnswers" ID="hfAnswers">
 </dxhf:ASPxHiddenField>
...
See Also