473,385 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

trying to find the html id of a textbox in FooterTemplate at runtime

Here is my goal. I have a textbox in the FooterTemplate of a datagrid

<FooterTemplate>
<asp:TextBox ID="txtFooterTextBox" Runat="server"></asp:TextBox>
</FooterTemplate>

When the html is created, in my case, it creates an html tag like this.

<input name="userLiabilities:dgFinancials:_ctl9:txtFooter TextBox"
type="text" id="userLiabilities_dgFinancials__ctl9_txtFooterTe xtBox" />

I need to get that id userLiabilities_dgFinancials__ctl9_txtFooterTextBo x AT
RUNTIME. How can I do that? I see can tell that the nomenclature consists
of the user control id, the id of the datagrid, the id of the textbox and
"__ctl9_" to assign uniqueness to the textbox (although because it is in the
footer, not in Item, txtFooterTextBox is already guaranteed to be unique).

I need to some how find that so that I can dynamically create javascript
code. So perhaps in the event handler for ItemCreated,

if (e.Item.ItemType == ListItemType.Footer)
{
//looking for the html unique ID
TextBox txtFooterTextBox = (TextBox)e.Item.FindControl("txtFooterTextBox");

//here I need to get the ID
userLiabilities_dgFinancials__ctl9_txtFooterTextBo x
}


Apr 6 '06 #1
3 2016
txtFooterTextBox.ClientID

Eliyahu

"David C" <pr********@yahoo.com> wrote in message
news:MW******************@tornado.socal.rr.com...
Here is my goal. I have a textbox in the FooterTemplate of a datagrid

<FooterTemplate>
<asp:TextBox ID="txtFooterTextBox" Runat="server"></asp:TextBox>
</FooterTemplate>

When the html is created, in my case, it creates an html tag like this.

<input name="userLiabilities:dgFinancials:_ctl9:txtFooter TextBox"
type="text" id="userLiabilities_dgFinancials__ctl9_txtFooterTe xtBox" />

I need to get that id userLiabilities_dgFinancials__ctl9_txtFooterTextBo x
AT RUNTIME. How can I do that? I see can tell that the nomenclature
consists of the user control id, the id of the datagrid, the id of the
textbox and "__ctl9_" to assign uniqueness to the textbox (although
because it is in the footer, not in Item, txtFooterTextBox is already
guaranteed to be unique).

I need to some how find that so that I can dynamically create javascript
code. So perhaps in the event handler for ItemCreated,

if (e.Item.ItemType == ListItemType.Footer)
{
//looking for the html unique ID
TextBox txtFooterTextBox =
(TextBox)e.Item.FindControl("txtFooterTextBox");

//here I need to get the ID
userLiabilities_dgFinancials__ctl9_txtFooterTextBo x
}

Apr 6 '06 #2
Tried it in the event handler for ItemCreated

The ClientID is txtFooterTextBox, not
userLiabilities_dgFinancials__ctl9_txtFooterTextBo x . I should have said so
in my posting. I also tried UniqueID, but it's still set to
txtFooterTextBox.

Thanks.
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uo**************@TK2MSFTNGP02.phx.gbl...
txtFooterTextBox.ClientID

Eliyahu

"David C" <pr********@yahoo.com> wrote in message
news:MW******************@tornado.socal.rr.com...
Here is my goal. I have a textbox in the FooterTemplate of a datagrid

<FooterTemplate>
<asp:TextBox ID="txtFooterTextBox" Runat="server"></asp:TextBox>
</FooterTemplate>

When the html is created, in my case, it creates an html tag like this.

<input name="userLiabilities:dgFinancials:_ctl9:txtFooter TextBox"
type="text" id="userLiabilities_dgFinancials__ctl9_txtFooterTe xtBox" />

I need to get that id userLiabilities_dgFinancials__ctl9_txtFooterTextBo x
AT RUNTIME. How can I do that? I see can tell that the nomenclature
consists of the user control id, the id of the datagrid, the id of the
textbox and "__ctl9_" to assign uniqueness to the textbox (although
because it is in the footer, not in Item, txtFooterTextBox is already
guaranteed to be unique).

I need to some how find that so that I can dynamically create javascript
code. So perhaps in the event handler for ItemCreated,

if (e.Item.ItemType == ListItemType.Footer)
{
//looking for the html unique ID
TextBox txtFooterTextBox =
(TextBox)e.Item.FindControl("txtFooterTextBox");

//here I need to get the ID
userLiabilities_dgFinancials__ctl9_txtFooterTextBo x
}


Apr 6 '06 #3
I am not sure if ItemCreated event is good for you. Try to do the same in
ItemDataBound, or, maybe, in preRender event.

Property ClientID is designed specially for getting control id as it is set
on client.

Eliyahu

"David C" <pr********@yahoo.com> wrote in message
news:Tw*******************@tornado.socal.rr.com...
Tried it in the event handler for ItemCreated

The ClientID is txtFooterTextBox, not
userLiabilities_dgFinancials__ctl9_txtFooterTextBo x . I should have said
so in my posting. I also tried UniqueID, but it's still set to
txtFooterTextBox.

Thanks.
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uo**************@TK2MSFTNGP02.phx.gbl...
txtFooterTextBox.ClientID

Eliyahu

"David C" <pr********@yahoo.com> wrote in message
news:MW******************@tornado.socal.rr.com...
Here is my goal. I have a textbox in the FooterTemplate of a datagrid

<FooterTemplate>
<asp:TextBox ID="txtFooterTextBox" Runat="server"></asp:TextBox>
</FooterTemplate>

When the html is created, in my case, it creates an html tag like this.

<input name="userLiabilities:dgFinancials:_ctl9:txtFooter TextBox"
type="text" id="userLiabilities_dgFinancials__ctl9_txtFooterTe xtBox" />

I need to get that id
userLiabilities_dgFinancials__ctl9_txtFooterTextBo x AT RUNTIME. How
can I do that? I see can tell that the nomenclature consists of the
user control id, the id of the datagrid, the id of the textbox and
"__ctl9_" to assign uniqueness to the textbox (although because it is in
the footer, not in Item, txtFooterTextBox is already guaranteed to be
unique).

I need to some how find that so that I can dynamically create javascript
code. So perhaps in the event handler for ItemCreated,

if (e.Item.ItemType == ListItemType.Footer)
{
//looking for the html unique ID
TextBox txtFooterTextBox =
(TextBox)e.Item.FindControl("txtFooterTextBox");

//here I need to get the ID
userLiabilities_dgFinancials__ctl9_txtFooterTextBo x
}



Apr 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: tascien | last post by:
I am just wondering... can footertemplate hold data? b/c i want to show the sum of my Invoice in footer template. How can i do that? I could add the sum to the dataset like this: SumColumn =...
1
by: MattB | last post by:
OK, never mind my last post. It was easy enough to refer to the table the repeater is bound to, but I made a big, incorrect assumption in that post. In my last post I thought I was successfully...
2
by: Chris Fink | last post by:
This should be relatively simple but I am unable to find an asp:button tag in a datalist footer. I have tried it numerous ways including the FindControl method from the many events that the...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
5
by: Steven Berkovitz | last post by:
Hi there, I am having a problem where if i add an attribute to a control at runtime the rendered attribute is HTML encoded. For example, on a textbox: textBox.Attributes = "if(x && y)...
2
by: shapper | last post by:
Hello, I created nested pages as follows: Base.master | ------ Global.master | ------ TwoColumns.master | ------ Default.aspx In Global.master.vb I added a textbox in runtime:
3
by: John Kotuby | last post by:
Hi all... I am trying to do a simple thing and maybe am missing something elementary. I have created a Javascript function at the top of a page which is meant to enable editing of an HTML input...
0
parshupooja
by: parshupooja | last post by:
Hey All, I have where I want to do some manipulations and show in other column but unable to find their values in RowDatabound event even though I have two records in gridview <asp:GridView...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.