I added a TemplatedField in an ultrawebgrid,and it has a linkbutton in this TemplatedField.How do get the row when I clicked the linkbutton in client-side?
I am not sure what is different in your case, it is working perfectly fine for me. Here is my setup:
<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" DataSourceID="AccessDataSource1" Height="200px" Width="325px"> <bands> <igtbl:UltraGridBand> <Columns> <igtbl:TemplatedColumn> <CellTemplate> <asp:LinkButton runat="server" ID="MyLinkButton" Text="Press Me" OnClientClick="doSomething('<%# Container.Cell.Row.Index %>')" /> </CellTemplate> </igtbl:TemplatedColumn> <igtbl:UltraGridColumn BaseColumnName="EmployeeID" DataType="System.Int32" IsBound="True" Key="EmployeeID"> <Header Caption="EmployeeID"> </Header> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="LastName" IsBound="True" Key="LastName"> <Header Caption="LastName"> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="FirstName" IsBound="True" Key="FirstName"> <Header Caption="FirstName"> <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> </div> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Nwind.mdb" SelectCommand="SELECT [EmployeeID], [LastName], [FirstName] FROM [Employees]"> </asp:AccessDataSource>
And you can see on the screenshot what I get, clicking the links gives the correct IDs of the rows for me.
the' <%# Container.Cell.Row.Index %>' didn't work.It show "cannot resolve symbol 'Cell'".
Hello,
I guess you can use databiding expression ro send the row index of the row to the client using something similar to:
<asp:LinkButton runat="server" ID="MyLinkButton" Text="Press Me" OnClientClick="doSomething('<%# Container.Cell.Row.Index %>')" />
Then, on the client-side, you will have the index and can use the grid client-side object model (CSOM) documented here:
http://help.infragistics.com/NetAdvantage/NET/2008.2/CLR3.5/
to get to the actual row instance based on the index.
Please, let me know if this helps