Problem regarding ASP.Net

  • Thread starter M. Zaheer-Ud-Din
  • Start date
M

M. Zaheer-Ud-Din

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top