Problem regarding ASP.Net

Discussion in 'ASP .Net Web Controls' started by M. Zaheer-Ud-Din, Jul 4, 2003.

  1. Hi,

    I am facing some problems in ASP.Net.

    I have a simple text box(not runat=server). I can access this text box in
    the server side code by using its name. But when I disabled(by setting the
    property) this text box, I am not able to get the access this text box. How
    can I get the respective text box access.

    The second problem is that there is a server control(Text box) and a simple
    Client control(Text box i.e., not runat server) I disabled both of them(by
    setting the property). Now I am going to change the value of these text
    boxes by the client side scritping as shown in the code. Now the problem is
    that I can't get the changed value in the server side code.

    '=============Client Script======================
    ....
    <body onload="bdyLoad()" onunload="bdyUnLoad()" MS_POSITIONING="GridLayout">
    <asp:textbox AutoPostBack="False" id="svrTxt" style="Z-INDEX: 102; LEFT:
    152px; POSITION: absolute; TOP: 96px" runat="server" ReadOnly="True"
    Enabled="False">Server Text</asp:textbox><asp:label id="Label1"
    style="Z-INDEX: 103; LEFT: 17px; POSITION: absolute; TOP: 98px"
    runat="server" Width="107px">Server Text Box</asp:label>
    <asp:label id="Label2" style="Z-INDEX: 104; LEFT: 13px; POSITION:
    absolute; TOP: 137px" runat="server" Width="110px">Client Text
    Box</asp:label>
    <INPUT id="clientTxt" style="Z-INDEX: 105; LEFT: 151px; POSITION:
    absolute; TOP: 138px" type="text" value="Client Text" name="clientTxt"
    disabled>
    <INPUT id="ClientBtn" style="Z-INDEX: 106; LEFT: 140px; POSITION:
    absolute; TOP: 175px" onclick="ClientBtn_Click()" type="button"
    value="Client Button" name="ClientBtn">
    <asp:button AutoPostBack="false" id="ServerBtn" style="Z-INDEX: 107; LEFT:
    13px; POSITION: absolute; TOP: 176px" runat="server" Text="Server
    Button"></asp:button>

    <script language="vbscript">

    Function bdyLoad()
    MsgBox("In Body Load method")
    'window.Form1.clientTxt.disabled=true
    End Function

    Function bdyUnLoad()
    MsgBox("In Body UnLoad method")
    End Function

    Function ClientBtn_Click()
    MsgBox("Hit on Client Script --ClientBtn_Click")
    Form1.clientTxt.value="New Value for Client Text Box"
    Form1.svrTxt.value="New Value for Server Text Box"
    End Function
    </script>
    </body>
    ....


    '================Server Code========
    ....
    Private Sub ServerBtn_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles ServerBtn.Click
    Response.Write("Client text==> " & Request.Form("clientTxt"))
    Response.Write("<br>Server Text==> " & Request.Form("svrTxt"))
    End Sub
    ....



    Any help will be highly appreciated.
    Regards
    ZaHeer
     
    M. Zaheer-Ud-Din, Jul 4, 2003
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.