How to access a DevExpress ASPx control via JSProperties on the client

John2026

New Member
Lets say that I have several DevExpress controls and one of them is a button. On that button I want to add the ClientInstanceNames of each of the other controls so that I can access them in the buttons client side click event..c#:\[code\]String strID = "MyButton";ASPxButton btn = new ASPxButton() { ClientInstanceName = strID , Text = "Click Here", Width = new Unit("100%"), AutoPostBack = false, CssFilePath = strCssFilePath, CssPostfix = strCssPostFix };btn.ClientSideEvents.Click = "btnClick";btn.JSProperties.Add("cp_MyTxtBx", strID );\[/code\]I want to do something similar to this...js:\[code\]<script type="text/javascript"> function btnClick(s, e) { var theTxtBx = document.getElementById(s.cp_MyTxtBx); theTxtBx.SetText('some text'); }</script>\[/code\]But that doesn't work.I know that I could do it like this:\[code\]<script type="text/javascript"> function btnClick(s, e) { MyTxtBx.SetText('some text'); }</script>\[/code\]But these controls are dynamically created and I will not know their ClientInstanceNames until run time.So, how can I get the control based on the String JSProperty of its ClientInstanceName?Thanks in advance.Related posts but not quite what I need: How to access the value of an ASPxTextBox from JavaScriptDevExpress: How do get an instance of a control client-side and access its client-side members?
 
Top