Hi,
I'm using a HyperLink column in a webGrid. Clicking the hyperLink opens a new window, but the new opened window does not get the focus.
I did it by:
CEIDCell.Column.Type = ColumnType.HyperLink;
CEIDCell.AllowEditing = AllowEditing.No;
How can I cause the new window get the focus?
Thanks
Maya
Intel
I am trying to reproduce this error, unfortunately to no avail. Is there something that I am missing? I am binding to standard NorthWind database and using your syntax in the grid InitializeRow event. I tested both in Firefox and IE and was able to get the new page open and gain office just fine.
Is it possible that there is something else that is interfering with the focus on the page (e.g. input controls, other control on the page, etc).
Here is my code:
<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" DataSourceID="AccessDataSource1" Height="200px" oninitializerow="UltraWebGrid1_InitializeRow" Width="325px"> <bands> <igtbl:UltraGridBand> <Columns> <igtbl:UltraGridColumn BaseColumnName="ProductID" DataType="System.Int32" IsBound="True" Key="ProductID"> <Header Caption="ProductID"> </Header> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="ProductName" IsBound="True" Key="ProductName"> <Header Caption="ProductName"> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="SupplierID" DataType="System.Int32" IsBound="True" Key="SupplierID"> <Header Caption="SupplierID"> <RowLayoutColumnInfo OriginX="2" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="2" /> </Footer> </igtbl:UltraGridColumn> </Columns> <addnewrow view="NotSet" visible="NotSet"> </addnewrow> </igtbl:UltraGridBand> </bands> <displaylayout bordercollapsedefault="Separate" name="UltraWebGrid1" rowheightdefault="20px" version="4.00"> <framestyle borderstyle="Solid" borderwidth="1px" font-names="Verdana" font-size="8pt" height="200px" width="325px"> </framestyle> <pager> <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"> <borderdetails colorleft="White" colortop="White" /> </PagerStyle> </pager> <editcellstyledefault borderstyle="None" borderwidth="0px"> </editcellstyledefault> <headerstyledefault backcolor="LightGray" borderstyle="Solid"> <borderdetails colorleft="White" colortop="White" /> </headerstyledefault> <rowstyledefault backcolor="White" bordercolor="Gray" borderstyle="Solid" borderwidth="1px" font-names="Verdana" font-size="8pt"> <padding left="3px" /> <borderdetails colorleft="White" colortop="White" /> </rowstyledefault> <addnewbox> <boxstyle backcolor="LightGray" borderstyle="Solid" borderwidth="1px"> <borderdetails colorleft="White" colortop="White" /> </boxstyle> </addnewbox> <activationobject bordercolor="" borderwidth=""> </activationobject> </displaylayout> </igtbl:UltraWebGrid> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Nwind.mdb" SelectCommand="SELECT [ProductID], [ProductName], [SupplierID] FROM [Alphabetical List of Products]"> </asp:AccessDataSource>protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { UltraGridCell CEIDCell = e.Row.Cells.FromKey("ProductID"); CEIDCell.Column.Type = ColumnType.HyperLink; CEIDCell.TargetURL = string.Format("@[_blank]default.aspx?ID={0}", CEIDCell.Value); CEIDCell.AllowEditing = AllowEditing.No; }
Thanks for your reply.
It works fine when I have only one bound webGrid. But when I have another bound webGrid on the same page then the new window opened from the first webGrid loses the focus. (if the second webGrid is not bound then its ok)
Please advice, I feel like I'm loosing my mind with that issue
I'm trying to implement that solution, but I'm using ultraWebGrid and I could not find any mouse event or property on it.
Please advice
Maya,
This isn't in the code behind, it's client side java script. Go to the properties of the grid. Open DisplayLayout, then ClientSideEvents. You'll see the two events there. In the drop-down, select "Add new handler" and it will create the blank java script place holder for you. Then you can paste in the code above.
Thanks, I tried it but I guess I missed something...
First of all - the problem occurs only when I have 2 webGrids on the same page. When its only one then everything is ok. So do I need to implement these 2 methods for both of the Grids or only for the one which contains the link?
And, Could you please explain the meaning of the return value of MouseDownHandler and MouseUpHandler? I'm asking it in order to understand what to write in the method body.
Hi Maya,
Try adding this code for MouseDown client side event for the grid which contains link.
function grid_MouseDownHandler(gridName, id, button)
{
var grid = igtbl_getGridById(gridName);
grid.Element.removeAttribute("mouseDown");
}
Set client side event handler as below.
<ClientSideEvents MouseDownHandler="grid_MouseDownHandler"
Let me know if this works for you.
Greetings
Hey HBA,
Thank you soooooooooo much...
i tried it and it works successfully.....