Avatar of danielnp20
danielnp20Flag for Colombia

asked on 

get and set value of an input text throught code behind

Hi all,

I've created an user control and there i have an input text, but in the code behind i need a property to get and set the value for the control.

I can not add the "runnat=server" attribute to the control or change it into a textbox, because y have javascript code given by Telerik controls.

I tried different ways but i cant get or set the values throught the form that has instanced the UC.


** the control works great but i need to capture the input control info.

Thanks .. it is really important

Here is my HTML Code
 
<script type="text/javascript">
    function openWin(url)
    {
        var oWnd = radopen(url, "RadWindow1");
        oWnd.setSize(500,500);
        //set a function to be called when RadWindow is closed
        oWnd.add_close(OnClientClose);
    }
 
    function OnClientClose(oWnd)
    {
        var returnValue = oWnd.argument.retValue;        
        var txt1 = document.getElementById("txt");
        txt1.value = returnValue;
    }
</script>
 
......
<input id="txt" type="text" />
 
________ Code Behind
 
i tried using:
public string Text
{
    get 
    {
       HtmlInputText txt = new HtmlInputText();
       txt = (HtmlInputText)Request.Form["txt"]; //doesnt works
       string = Request.Form["txt"].ToString() //returns null         
       return txt.Value; 
    }
    set 
    { 
       this.txt.Value = value; 
    }
}
 
how can i get a reference to the control????

Open in new window

.NET ProgrammingJScriptHTML

Avatar of undefined
Last Comment
danielnp20
ASKER CERTIFIED SOLUTION
Avatar of naspinski
naspinski
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of danielnp20
danielnp20
Flag of Colombia image

ASKER

i cant use it because i'm using telerik controls that have all the code in the client side and if i add the runat="server" to the control it wont assign the return value

function OnClientClose(oWnd)
    {
        var returnValue = oWnd.argument.retValue;        
        var txt1 = document.getElementById("txt");
        txt1.value = returnValue;

this function obtains the retun value of other form and assigned to the control ..... with the runat, it doesnt assign anything.

thats the problem
Avatar of naspinski
naspinski
Flag of United States of America image

Sorry, I steer clear of third party controls.  

In my opinion, it is not worth it pay money for something that will limit my programming.
Avatar of danielnp20
danielnp20
Flag of Colombia image

ASKER

thanks,  i tru difierent ways to make this work, but i really need to put the runnat server and control he info with js.
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo