By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,870 Members | 1,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,870 IT Pros & Developers. It's quick & easy.

Table Control - how to recognize Text box

P: n/a
Hi,

I am using table control to create table/cell & 2 text box & one image
button during runtime. Onclick event of image button i would like to
validate if there is any value in either of text boxes, but my intellisense
will not recognize those textboxes created during runtime. How to overcome
this issue. Pl. help.

protected void Page_Load(object sender, EventArgs e)

{
TableCell cellDateRange = new TableCell();
cellDateRange.Text = "Date Range:From - To : ";

TableCell txtDtFromCell = new TableCell();
TextBox txtDtFrom = new TextBox();

TableCell txtDtToCell = new TableCell();
TextBox txtDtTo = new TextBox();

TableCell imgCell = new TableCell();
ImageButton imgSubmit = new ImageButton();
imgSubmit.ImageUrl = "..\\images\\view.gif";
imgSubmit.Click += new ImageClickEventHandler(ImgSubmit_Click);

row.Cells.Add(cellDateRange);
txtDtFromCell.Controls.Add(txtDtFrom);
row.Cells.Add(txtDtFromCell);
txtDtToCell.Controls.Add(txtDtTo);
row.Cells.Add(txtDtToCell);

imgCell.Controls.Add(imgSubmit);
row.Cells.Add(imgCell);
filTable.Rows.Add(row);

}

public void ImgSubmit_Click(object sender, ImageClickEventArgs e)

{

lblMessage.Text = "";

if txtDtFrom.Text == "") ======> i get error here intellisense cannont
understand txtDtFrom

{
}

}

Jan 30 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Found answer by myself , thought it will be useful for the community

public void ImgSubmit_Click(){

TextBox i;

i = (TextBox)Page.FindControl("txtID");

if (!(i == null))

{

lblMessage.Text = i.Text;

}

else

{

lblMessage.Text = "not found";

}

}

"Krish" <vi***************@GMAIL.com> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
Hi,

I am using table control to create table/cell & 2 text box & one image
button during runtime. Onclick event of image button i would like to
validate if there is any value in either of text boxes, but my
intellisense will not recognize those textboxes created during runtime.
How to overcome this issue. Pl. help.

protected void Page_Load(object sender, EventArgs e)

{
TableCell cellDateRange = new TableCell();
cellDateRange.Text = "Date Range:From - To : ";

TableCell txtDtFromCell = new TableCell();
TextBox txtDtFrom = new TextBox();

TableCell txtDtToCell = new TableCell();
TextBox txtDtTo = new TextBox();

TableCell imgCell = new TableCell();
ImageButton imgSubmit = new ImageButton();
imgSubmit.ImageUrl = "..\\images\\view.gif";
imgSubmit.Click += new ImageClickEventHandler(ImgSubmit_Click);

row.Cells.Add(cellDateRange);
txtDtFromCell.Controls.Add(txtDtFrom);
row.Cells.Add(txtDtFromCell);
txtDtToCell.Controls.Add(txtDtTo);
row.Cells.Add(txtDtToCell);

imgCell.Controls.Add(imgSubmit);
row.Cells.Add(imgCell);
filTable.Rows.Add(row);

}

public void ImgSubmit_Click(object sender, ImageClickEventArgs e)

{

lblMessage.Text = "";

if txtDtFrom.Text == "") ======> i get error here intellisense cannont
understand txtDtFrom

{
}

}

Jan 30 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.