How to disable text box depends on user choosing text box?
I m creating web application page in that fields are
departuredate = textbox
lodging = textbox
food claim = textbox
Daily allowances = textbox
Add(button)
now My requirement is when the user choose lodging and food claim text boxes daily allowance colmun ll be read only mode. like the same if daily allowances choosed lodging & food claim read only mode.
how to make a code?


Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 14, 2013, 1:45 AM EDT
in aspx page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default7.aspx.cs" Inherits="Default7" %>
in .cs page:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default7 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void TxtLdg_TextChanged(object sender, EventArgs e)
{
if (TxtLdg.Text != string.Empty)
{
TxtFdAl.Enabled = false;
TxtFdAl.BackColor = System.Drawing.Color.Gray;
}
else
{
TxtFdAl.Enabled = true;
TxtFdAl.BackColor = System.Drawing.Color.White;
}
}
protected void TxtFoAl_TextChanged(object sender, EventArgs e)
{
if (TxtFoAl.Text != string.Empty)
{
TxtFdAl.Enabled = false;
TxtFdAl.BackColor = System.Drawing.Color.Gray;
}
else
{
TxtFdAl.Enabled = true;
TxtFdAl.BackColor = System.Drawing.Color.White;
}
}
protected void TxtFdAl_TextChanged(object sender, EventArgs e)
{
if (TxtFdAl.Text != string.Empty)
{
TxtFoAl.Enabled = false;
TxtLdg.Enabled = false;
TxtLdg.BackColor = System.Drawing.Color.Gray;
TxtFoAl.BackColor = System.Drawing.Color.Gray;
}
else
{
TxtLdg.Enabled = true;
TxtFoAl.Enabled = true;
TxtLdg.BackColor = System.Drawing.Color.White;
TxtFoAl.BackColor = System.Drawing.Color.White;
}
}
}
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 12, 2013, 4:10 AM EDT
Try like this
Regards,
Iftikar
Rocky RockyRank #7,391 · 242 reputationPosted Aug 12, 2013, 9:22 PM EDT
nt woriknig these java script is any other code is there?
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 12, 2013, 9:26 PM EDT
Regards,
Iftikar
Rocky RockyRank #7,391 · 242 reputationPosted Aug 12, 2013, 9:34 PM EDT
When I choose the Lodging and food claim ,daily allowance also enable its not on read only mode.
what can i do?
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 12, 2013, 9:36 PM EDT
Regards,
Iftikar
Rocky RockyRank #7,391 · 242 reputationPosted Aug 12, 2013, 9:40 PM EDT
My asp.net code:
===========
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 12, 2013, 9:51 PM EDT
Regards,
Iftikar
Rocky RockyRank #7,391 · 242 reputationPosted Aug 12, 2013, 9:54 PM EDT
How to call javascript in my asp.net code?
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 12, 2013, 9:57 PM EDT
Regards,
Iftikar
Rocky RockyRank #7,391 · 242 reputationPosted Aug 12, 2013, 10:01 PM EDT
i wanna set textbox when the user enter lodging means at that time daily allowance is read only mode after add the details daily allowance ll show as normal.
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 12, 2013, 10:09 PM EDT
Regards,
Iftikar