ASPxClientHiddenField.Set(propertyName, propertyValue) Method
Adds a new value to the control’s collection of property name/value pairs, on the client side.
Declaration
Set(
propertyName: string,
propertyValue: any
): void
Parameters
Name | Type | Description |
---|---|---|
propertyName | string | A string value that specifies the property name. It can contain letters, digits, underline characters, and dollar signs. It cannot begin with a digit character. |
propertyValue | any | An object that represents the property value. |
Remarks
The Set method can be used on the client side, to add a new value to the control’s collection of property name/value pairs. Alternatively, the ASPxClientHiddenField.Add method can be used for the same purpose. 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.
Use the ASPxClientHiddenField.Get method, to obtain the value with specified property name.
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>
...