Hi,
I have a DataGrid control viz and the following
command handler for the click event on the
ButtonColumn. This is in one Frame of the Html page.
Now in the C# code I need to write code so that I can
change the html is soem other Frame. In Javascript
this would have been -
FrameName.location.replace("NewHtml.htm");
Page.Navigate changes the html of the current frame.
How can I set the target?
I tried using HyperLinkColumn where u can specify the
target , but I cannot have the CommandName attribute
which also I need!!!
thanks,
regadrs,
Leena.
void Grid_ClickCommand(Object sender,
DataGridCommandEventArgs e)
{
if (e.CommandName == "ClickLink")
{
TableCell dataCell = e.Item.Cells[1];
TableCell linkCell = e.Item.Cells[2];
String data = dataCell.Text;
String link = linkCell.Text;
lb1.Text = data + ":" + link;
Page.Navigate(link);
}
}
<asp:DataGrid id="MyDataGrid" runat="server"
BorderWidth="0"
GridLines="none"
CellPadding="3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#FFCC00"
AutoGenerateColumns="false"
OnItemCommand="Grid_ClickCommand"
OnPageIndexChanged="Grid_Change"
>
<property name="Columns">
<asp:ButtonColumn
HeaderText="Search results"
DataTextField="DisplayValue"
CommandName="ClickLink"
ButtonType="LinkButton" />