sakir
sakir

Reputation: 3502

Inside the usercontrol,get the element value

I have a text control inside usercontrol(ascx) like this *usercontrol is created dynamically

     <ext:TextField runat="server" ID="txtIl" Flex="1" FieldLabel="Il"
 ClientIDMode="Static"></ext:TextField>

and in this user control have a js code like this

var getformdata = function () {

                var il = $("#<%=txtIl.ClientID%>").val();

                alert(il);
                alert(<%=txtIl.ClientID%>);


            };

and inside again same usercontrol have a button which call the js function(getformdata )

 `<ext:Button runat="server" Icon="Add" Text="Ekle" Handler="getformdata();"></ext:Button`>

my problem is the value of the text field is getting undefined value. someone tell me where I am doing wrong.

Upvotes: 0

Views: 604

Answers (1)

Daniil Veriga
Daniil Veriga

Reputation: 1851

Please use

alert(App.txtIl.getValue())

to retrieve a TextField's value.

Upvotes: 1

Related Questions