how to access footertemplate row of a datagrid

  • Thread starter Thread starter shiv
  • Start date Start date
S

shiv

Hello all,

I am just wondering how to access FooterTemplate row
inside a datagrid programatically as i need to get hold
of TextBox control which is embedded inside the footer
column.

does anybody has any idea on the same?
thanks in advance
regards
shivanand
 
Hello all,

I am just wondering how to access FooterTemplate row
inside a datagrid programatically as i need to get hold
of TextBox control which is embedded inside the footer
column.

does anybody has any idea on the same?
thanks in advance
regards
shivanand
private void dgPackage_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName == "Insert")
{
DropDownList ddlLabel = (DropDownList)
e.Item.FindControl("Dropdownlist1");

Assuming that Dropdownlist1 is the name of the control.....
 
Thanks Hills,

But Here, I have a textBox Control within a FooterTemplate
column and that is not considered as an Item(its not
figured in list of items). Moreover i have to access this
on a click of a button not on any event associated with
DataGrid itself. Hope this gives you more insight into my
problem.

regards
 
Thanks Hills,

But Here, I have a textBox Control within a FooterTemplate
column and that is not considered as an Item(its not
figured in list of items). Moreover i have to access this
on a click of a button not on any event associated with
DataGrid itself. Hope this gives you more insight into my
problem.

regards


Ok, all the following goes in the html.

<script>
function doArtistSearch(pField){
var returnValue="";

returnValue=window.showModalDialog('dlgArtistFrame.html',window,
"dialogHeight:350px; dialogWidth:380px;
resizable:no;scroll:no;status:no;center:yes");
if(returnValue != "" && returnValue !=null){

document.getElementById("txtSearchArtist").value=returnValue;
var data = returnValue.split("~");
document.getElementById(pField).value=data[1];
}
}
</script>

That is a function that accepts the name of the textbox. It opens a
search dialog which returns an artist code and name separated by ~.
PS I know I don't need a param but this was once going to be used with
more than one pair of columns. Since it isn't, I hard-coded
txtSearchArtist and forgot to the same with the name field....

I have a hidden column with the artistcode and this is the footer
template for the name.

<FooterTemplate>
<input name="btnArtist" type="image" src="images/iconSearch.gif"
OnClick="doArtistSearch('txtArtist');return(false)">
<input type="text" name="txtArtist">
</FooterTemplate>

Not these are not asp controls. The code I posted earlier demonstrates
how to read these non-asp controls back at the server.

Basically the rest of the grid is normal, the footer row I use as a
new row to allow adding a new record.

HTH
 
Back
Top