I have a question regarding how to find and get the value of asp.net controls that are located within a RadPageView using Javascript. I have a form where I use the RadTabStrip in conjunction with the RadMultiPage. Each tab and RadPageView contain a User control which contains several asp.net label controls that display various data.
I need to access the values of several of these fields using Javascript. To do so, I had a javascript routine that got a reference to the PageView on the currently selected tab as follows:
The plan was then to use that reference to find, for example, a label control and extract its value. This proved difficult since the RadPageView does not seem to provide any methods to find controls contained within it.
I opened a support ticket with Telerik to solve this problem. They provided a solution to extract the contents of a label by using a unique CSS class by which I could find the label and get the contents. See the following for an example:
The ".cdhdr-carrlocationheader" is the custom css class assigned to the label control that I extracted the value for. This works althought they never did explain exactly how. I have no idea what the "$telerik.$" function is, the parameters it offers, or how it works.
Anyway, my problem now is that I would also like to be able to find some "HiddenFields" on the pageview and extract their values. The above solution will not work for them since you cannot assign a CSS class to a Hiddenfield.
Does anyone know how I could do this? Any help would be greatly appreciated.
I need to access the values of several of these fields using Javascript. To do so, I had a javascript routine that got a reference to the PageView on the currently selected tab as follows:
// This function returns a reference to the pageview of the currenlty selected tab.
function GetCurrPageView() {
var rtabCarrLoc = $find("<%= rtabCarrierInfo.ClientID %>");
var rselectedtab = rtabCarrLoc.get_selectedTab();
if (rselectedtab) {
var rpageview = rselectedtab.get_pageView();
return rpageview;
}
}
The plan was then to use that reference to find, for example, a label control and extract its value. This proved difficult since the RadPageView does not seem to provide any methods to find controls contained within it.
I opened a support ticket with Telerik to solve this problem. They provided a solution to extract the contents of a label by using a unique CSS class by which I could find the label and get the contents. See the following for an example:
// Get and set the location name.
var rpageview = GetCurrPageView();
if (rpageview) {
var lblLocName = $telerik.$(".cdhdr-carrlocationheader", rpageview._element).html();
if (lblLocName) {
var DULocName = document.getElementById("<%= lblDataUpdLocName.ClientID %>");
DULocName.innerText = lblLocName;
}
}
The ".cdhdr-carrlocationheader" is the custom css class assigned to the label control that I extracted the value for. This works althought they never did explain exactly how. I have no idea what the "$telerik.$" function is, the parameters it offers, or how it works.
Anyway, my problem now is that I would also like to be able to find some "HiddenFields" on the pageview and extract their values. The above solution will not work for them since you cannot assign a CSS class to a Hiddenfield.
Does anyone know how I could do this? Any help would be greatly appreciated.