views:

160

answers:

2

I have put an initial text in the text box of a asp.net web page. In the text property box.

I want to load the text in the load time of the webpage.

While i debug and run text box is not populating with that text.

Please help me.

 <td class="textFieldColumn" style="height:16px!important;">
                                                    <asp:TextBox ID="txtUserID" text="Enter User id.." runat="server" AutoPostBack="true" 
                                                        CssClass="text_box_3"></asp:TextBox>
                                                        <asp:RequiredFieldValidator ID="rfvUserID" CssClass="requiredField" runat="server" ControlToValidate="txtUserID"
                                                        ErrorMessage="* Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator><div class="smallText" nowrap>
                                                        &nbsp;&nbsp;(This would be the ID you would normally log on with.)</div></td>




  Private Sub mvRequestorForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles mvRequestorForm.Load
        txtUserID.Text = "Enter User ID..."
    End Sub













<input name="txtUserID" type="text" onchange="javascript:setTimeout('__doPostBack(\'txtUserID\',\'\')', 0)" onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" id="txtUserID" class="text_box_3" />

tHE RENDERED CODE

A: 

I would use a AJAX TextBoxWatermark

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/TextBoxWatermark/TextBoxWatermark.aspx

<ajaxToolkit:TextBoxWatermarkExtender ID="txtExtender1" runat="server"
    TargetControlID="txt"
    WatermarkText="Type First Name Here"
    WatermarkCssClass="watermarked" />
<asp:Textbox id="txt" ruant="server" />
Arthur
A: 

you can use Jquery for that http://fuelyourcoding.com/in-field-labels/

Muhammad Akhtar
i need to use plain .net !! nothing else