D
David C
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:txtFooterTextBox"
type="text" id="userLiabilities_dgFinancials__ctl9_txtFooterTextBox" />
I need to get that id userLiabilities_dgFinancials__ctl9_txtFooterTextBox 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_txtFooterTextBox
}
<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:txtFooterTextBox"
type="text" id="userLiabilities_dgFinancials__ctl9_txtFooterTextBox" />
I need to get that id userLiabilities_dgFinancials__ctl9_txtFooterTextBox 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_txtFooterTextBox
}