Asp.Net TextBox (Javascript/jQuery) - javascript

On my website I am having a text-box and I want to give it this type of functionality:
http://kyleschaeffer.com/best-practices/input-prompt-text/
On the above website javascript code is given but how can I actually combine it with my asp.net text-box server control. Also the initial text which I want to assign it will be coming from code behind.

You just need to set the title on your textbox like this:
myTextBox.Attributes["Title"] = "The Watermark Goes Here!";

Related

valueHelpOnly for smart filter bar in sapui5

I have included smartFilterBar:ControlConfiguration control in Smart Filter Bar. One of the controls has F4 value help. In this control, I can enter some text manually also. How can I disable entering the text and display value help dialog only on click of that filed. In short I want a feature similar to "valueHelpOnly" in Input field which disable manual entry of data.
Programatically you can do it in a following way:
myControl = this.getView().byId("smartFilterBar").getControlByKey("myControl")
myControl.setValueHelpOnly(true);
After that, clicking on selection field will automatically open the value help dialog.

I want a javascript function to make readonly false for a textbox in a dynamic table of ascx

I want to add an JavaScript function through which I can make my Text Box field editable instead of it being Read Only.
Also the table is a dynamic table in which I have my Text Box.
Please help me.
Code:
cell.Controls.Add(New clsHtmlInputCurr(cCTRNAMEPREFIX_ASSET_UNITPRICE, objAsset.UnitPrice, Not
IsEditable(enuActEditMode.eNew, enuActEditMode.eEdit_Proc1, enuActEditMode.eEdit_Proc1_ext), "startEdit(this)", "calcAssets(this)", 15, 100, enuHtmlCtrLabel.No, intAssNo, CI).Ctrl)
Is the textbox an asp component? If so, there's a chance that changes to values will be ignored when the page refreshes, as asp may choose to ignore the incoming value of a read only control.
Are you trying to avoid a page load? You could wrap the textbox in an UpdatePanel, then it can still be 'under asp control' while being able to change without a whole page load.

Fill a Textbox with a Link?

i have a link and i want to prepare it so that i fill a textbox with a value.
This is the link http://www.lolking.net/ and i want that if a always go to this site they fill the texbox where is write ("Summore name...").
How i can make this? Must be write a script for the site ? Or can i prepare link to fill this textbox?
This question is for all site where is a textbox, i get the name of the textbox with F12 and i want to prepare all links how i fill textbox
Greetz
You could reasonably write a Chrome extension which does this. You'd have to add logic for each site that you want it to work on, but actually replacing the text in that box (I assume that you want it to automatically search for your summoner name) is as simple as this one line:
document.getElementsByName("name")[0].value="<YOUR SUMMONER NAME>";
But that example will only work on lolking.net. To make it more general, you would replace "name" in the following way:
document.getElementsById("<INPUT ID>")[0].value="<REPLACEMENT TEXT>";

check with javascript if textbox is empty while using ajaxcontroltoolkit TextBoxWatermark

I have an asp.net TextBox and I'm using the TextBoxWatermark of AjaxControlToolkit to have it display some hing text while the box is empty.
Problem is, onclient click of a certain button, I want to determine if the textbox is empty. The javascript code of
document.getElementById(fieldName).value == ""
Is not working, since the WaterMark extender with it's hint text making the code to think the field is not empty.
Any solution to this?
You can use the wrapper to access whether the watermark is being displayed or not with get_IsWaterMarked.
Sys.Extended.UI.TextBoxWrapper.get_Wrapper(document.getElementById(fieldName)).get_IsWatermarked()
I tried this with version 4.1.7.1213 of AjaxControlToolKit.
Got the code from looking at the source code of the TextBoxWatermark control.
Refer to this: http://ajaxcontroltoolkit.codeplex.com/SourceControl/latest#Client/MicrosoftAjax.Extended/TextboxWatermark/TextboxWatermark.pre.js

how to assign asp.net label using JavaScript and Ajax

I am trying to assign a asp.net label using JavaScript and then whenever label text get changed to trigger Ajax UpdatePanal and update a grid based on text in the label.
This is what I have currently tried:
`function ChangeTeam(sPARENT_ID, sPARENT_NAME) {
alert("me1");
document.getElementById("Label4").value = "Text 123";
document.forms[0].submit();
}
function PopupHelp(page) {
var url = page;
window.open(url,'Select','width=600,height=600,status=0,resizable=1,scrollbars=1,toolbar=0,location=1');
}'
So what this is actually doing is: User click on a button under PAGE1 a new windows opens with PAGE2, PAGE2 contains checkboxes for user to select, once the user has made the selection on PAGE2 the selection ID is passed via JavaScript back to PAGE1 CHANAGETEAM() function where that function should populate a hidden label "Label4" and then based on that population of the label Ajax Panel should trigger and update a grid with the ID selected.
With the code I have above it gets back into CHANGETEAM() function and sends that alert ME1 but looks like nothing past that works. What am I doing wrong?
Thanks for your help.
The way .NET's controls are named on the page vs their IDs how they're rendered are different. If you inspect the source code of the rendered page, it's probably something along the lines of UpdatePanel1_Label4 instead of just Label4.
Besides hardcoding that name in, you can also get the rendered Id with the ClientId Property. So your code can look like
document.getElementById('<%= Label4.ClientID %>').value = "Text 123";

Categories