Modifing javascript to use server controls instead of using html controls

Hi, I use a Javascript to create a textbox that converts English to Hindi text. I am using it in my aspx pages. I use another javascript to access the Text of this HTML textbox.

 Everything is fine when I use Single TextBox on a page. But the complexities go out of my control when i need to use 5 such textboxes on the same aspx page. Moreover I encounter issues of ID of ASP.NET controls that get changed as there are ContentPlaceHolders, TabPanels etc.

I don't know the javascript things so deeply that I can comprehend the code that generates the custom Textbox.

Now I need some help so that I can use this Javascript to modify an ASP.NET TextBox which could behave the same way as the TextBox generated by this script. Should I paste the script here?

Any Helps?


.NET-ified
Arpit Khandelwal
Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
0
login
8/22/2008 10:59:02 AM
asp.net.client-side 24353 articles. 2 followers. Follow

5 Replies
1108 Views

Similar Articles

[PageSpeed] 51
Get it on Google Play
Get it on Apple App Store

hi arpit

ya i understand your problem.

if you post your code i will help you.


Ponkarthik.P,
Associate Software Engineer,
Zillion Information Systems,
Banglore.
0
ponkarthik
8/22/2008 11:35:19 AM
Thanks
.NET-ified
Arpit Khandelwal
Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
0
login
8/22/2008 11:38:41 AM

hi

i think your coading have simply one mistake i didn't go through the full code.here.

if you use contentplaceholder the txtbox id is changed while retriving throug java script

first you can create a simple client side Onkeypress function for text box and you pass that object like OnKeyPress=" return Find(this)" like these

you got a objoect in client side and you got a ID of this object like this

function Find(Ctrl)

{

 var a= Ctrl.id;

//here you can get a Id correctly you can continue your work

 

if it's answer mark as a answer


Ponkarthik.P,
Associate Software Engineer,
Zillion Information Systems,
Banglore.
0
ponkarthik
8/22/2008 11:53:27 AM

 thats really not my problem at all...

All i want to say is this script works fine to create a textbox with certain behaviour

I want it to make an existing textbox (of course ASP.NET Textbox) with the same behavious. Thats all i want


.NET-ified
Arpit Khandelwal
Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
0
login
8/22/2008 12:02:37 PM

You cannot create an ASP:TextBox client-side since by then it is already rendered. You could however attach an event to one:

<asp:textbox id="TextBox1" onkeydown="return someJavaScriptFunction();" runat="server"></asp:textbox>

Note that I attached the event handler in the HTML declaration. This will work, but will produce a compiler warning. The proper way to do this for a server control is in the Page_Load handler of the server-side code like this:
 TextBox1.Attributes.Add("onkeydown", "return someJavaScriptFunction();");

NC...

0
NC01
8/25/2008 3:30:00 PM
Reply:

Similar Artilces:

How to access dynamically Html controls (client side controls) using C# server side scripts
Folks,I have problem try to to access dynamically Html controls (client side controls) using C# server side scripts. Please give me helps.     The error is as follows Exception Details: System.InvalidCastException: Specified cast is not valid.Source Error: Line 79: { Line 80: Control c = Page.FindControl("ddlTC" + i); Line 81: ((DropDownList)c).DataSource = mdt; Line 82: ((DropDownList)c).DataTextField = "ClassID"; Line 83: ((DropDownList)c).DataValueField = "Course"; My aspx page source codes: ...<...

How do YOU build your server controls? Using writer to output html or using controls?
What's the preferred way of overriding Render when building server controls?  Is it better to use the writer to output the html with RenderBeginTag and etc, or is it better to just create a table/panel control and add controls to it and render the table/panel control?For example, let say I want to create a server control to output the following in html<table>   <tr>      <td>         Welcome      </td>      <td&g...

What control do I use (or do I not use a control at all...)
Okay so here's the story so far. I am making a blog to be incorporated into a website. Well, I'm doing the blog from scratch. I'm using MySQL to source all the data via MySQL .NET/Connector. Now while developing the script, I used DataReader and Response.Write to show the blog topics. Now that it has come to put it under a design (I'm using a Master Page for that), I've hit the problem. Response.Write shows all the topics before any of the design elements could be incorporated. So that (more or less) is out of question. So next I looked into the data presentation controls. I looked up GridVi...

Is there a correspondance for each server side control to be equivalent to a client side html control
Where can find the list and can use that equivalence and what is its usage plsThanksThanks a lot, I appreciate your taking the time to help me. What exactly do you mean? A correspondence of what?All controls have a ClientID property, which for most controls tells the DOM element ID that will be used in the HTML rendering. Aside from that certain controls might offer additional client-side functionality, but there's no one standard.Thanks,EilonBlog: http://weblogs.asp.net/LeftSlipper/ I mean. When I am using html control in my aspx page like:  <input type=text ..>  and...

finding server control, in the code behind, created from client side using javascript
Hi experts   i wanna add server side controls using javascript and access it in code behind but i am not able to access it can u give me the solution example javascript file function AddControl() { var table=document.createElement('table') var tr=document.createElement('tr') var cell1=document.createElement('td') cell1.innerHtml='<input type="text" ID="txtSample" runat="server"/> tr.appendChild(cell1) table.appendChild(tr); }   if i try to get this control in code behind like this i am not able to get ...

Client side clock using server side controls
Is it possible to create a client side clock using a server side control (label or textbox) in C# without accessing JavaScript?  If so, how? In principal it is possible, it depends how often you need to reload this clock ... if every second than: 1. It is no sens to do I mean 2. You need than to make setTimeout client script, to refresh page every second With FastPage it seems more real task ... http://fastpage.more.at...

How do I pass other HTML control in HTML control's click event using Javascript ?
Hello friends, Please give any idea for  how do I pass HTML control to Javascript code.  exam given below.. ------------------------------------------------------------------------------------------------------------------------<script>function SwitchTLStateTreeList1($nodeValue,$imgBtn){  $mode = 'table-row';  if ($imgBtn.src.search(/icon_collapse/) != -1)  {    $imgBtn.src = $imgBtn.src.replace(/collapse/g,'expand');    $mode = 'none';  }  else if ($imgBtn.src.search(/icon_expand/) != -1) &nb...

validation, is it better to have client side or use server side validator controls
 Hi All. I want to do validation on text boxes etc. Is it better to do client side validation or just use the server side validation controls?   Hi!  If for server side controls you mean RequiredFieldValidator, CompareValidator, RegularExpressionValidator, etc.. i can tell you that they use client and server validation. For instance if you use a RequiredFieldValidator, on the client will be a validation, but on the server this condition will be evaluated again. Probably one of the objetives of this is deal with client with javascript disabled. Of course I ...

Want to used Standard Control instead of HTML control
hi, is someone can tell me how i can replace the following : Response.Write("<Image id=" & h & BBLOCK(j) & BID(j) & h & " src=" & h & GLOBAL_IMG_URL & BCONTENT(j) & h & "/><br/>") by the same in standard control (using Image). I've try to done it without succes. thanks  You'd probably have to define the image in your code-behind (or script if you're using inline code): Dim myImage As New Image() myImage.ID = whateverTheIDisSupposedToBe myImage.ImageURL = whateverTheURLIsSupposedToBe ' Then you need to put the image control i...

Client validation using both Javascript and .NET controls
 Hello,I have implemented an online questionnaire. The questionnaire is composed by several textboxes to gather information such as name, organization,email, phone, etc. and a long series of radiobuttonlists and textboxes (text area). These last textboxes need to be filled out only if the user select a specific value in the radiobuttonlists.To perform client validation I used .NET controls to check the format of the first textboxes (name, organization,email, phone, etc. ) and the text areas to ensure that no invalid characters have been entered.To check the all the radiobuttonlist has b...

Using Javiscript client side on a server control
Hi There. I have a little problem and it has got to the stage that I can not see the wood for all of the trees. My problem is this. I would like to set the value a text box on the client (sort of auto population based on certain values without a postback). On a post back I would like to be able to reference the value as a textbox server control. My question is, How do I set the value of a web server control, in this case a text box, using JScript so that I can retrive the value when posted? Perhaps someone can help me. Regards Would the textbox be autopopulated ...

Use server side control to call javascript
I have embedded windows media player, on a ASP.NET webpage. I am trying to dynamically assign the url/file for windows media player to play. The only way I figured out to do this was through javascript. I am using the ASP.NET platform because I am pulling the URL's for windows media player to play from a  webservice.      For testing purposes, I have one URL that I am trying to get the media player to run, for the button click event(server-side).  Response.Write("<script language='javascript'>{Pl...

How to use client-side script(javascript) in DNA using .Net Remoting
Hi all,     It was known that SAO and Singleton object about .Net Remoting. When I Create an object in server side and hosting in IIS's virtual directory,I want to use javascript asynchronous invoking the remote object by HTTP channel, 80 port and SOAP formatter just like XMLHTTP invoking web service. My code as following, <script> objXmlDoc = new ActiveXObject("Msxml2.DOMDocument"); objHttp = new ActiveXObject("Msxml2.XMLHTTP"); strEnvelope = ?? objHttp.onreadystatechange = function() { ...... }   szUrl = "http://ServerNa...

How to access all the methods of server controls and infragistics controls from client-side javascript.
I have some web controls on my page, which i want to manipulate without going to the server, that is, from a client-side javascript. I know how to call them with the documents.forms.... but i do not know how to call their methods. For the text box, the method to manipulate it is 'value'. It's a property i think. for the html <select> it is the 'options' array. But for the others, I dont know.My question is the following:I have an infragistics control: the UltraWebTree.This is its code in html: <ignav:ultrawebtree id="UltraWebTree1" style="Z-INDEX: 108; LEFT: 352p...

Web resources about - Modifing javascript to use server controls instead of using html controls - asp.net.client-side

JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop
Your comprehensive JavaScript, DHTML, CSS, and Ajax stop

Let's Code: Test-Driven Javascript by James Shore — Kickstarter
James Shore is raising funds for Let's Code: Test-Driven Javascript on Kickstarter! A screencast series focusing on rigorous, professional Javascript ...

Eloquent JavaScript: A Modern Introduction to Programming
... and pragmatics. I loved the tutorial-style game-like program development. This book rekindled my earliest joys of programming. Plus, JavaScript! ...

Lightbox (JavaScript) - Wikipedia, the free encyclopedia
On a Lightbox-enabled page, a user can click an image to have it magnified in a Lightbox window, which resizes itself according to the size of ...

Open Directory - Computers: Programming: Languages: JavaScript: Tools: Obfuscators
about dmoz - help Top : Computers : Programming : Languages : JavaScript : Tools : Obfuscators Tools for obfuscation/compression JavaScript code. ...

Facebook File-Transfer App Pipe Relaunches, Now Works Via JavaScript, WebRTC
... allowed Facebook users to send and receive files up to 1 gigabit in size. A new version of Pipe debuted Monday, and the app now works via JavaScript ...

Under the Hood: The JavaScript SDK - The use of polyfills - Facebook
Facebook Engineering hat eine Notiz mit dem Titel Under the Hood: The JavaScript SDK - The use of polyfills geschrieben. Du kannst den vollständigen ...

JavaScript SDK - Facebook-Entwickler
Overview The JavaScript SDK provides a rich set of client-side functionality for accessing Facebook...

Senior Front-End Developer (Javascript and AJAX)
Company: Sometrics Category: Software Development Location: Los Angeles, CA How to Apply: jobs@sometrics.com Description: We are looking for ...

Badass JavaScript (@badass_js) on Twitter
WebGLWorker is an open source library that allows using WebGL from Web Workers. Great work as always from @kripken . blog.mozilla.org/research/2014/… ...

Resources last updated: 12/15/2015 6:17:24 AM