|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
LinkButton field and FindControlHi,
I have a LinkButton in a TemplateField inside my GridView How do I access this control in the RowDataBound handler? I've tried this: Dim LinkEdit As LinkButton If e.Row.RowType = DataControlRowType.DataRow Then LinkEdit = e.Row.FindControl("LinkEdit") LinkEdit.CausesValidation="true" End If but it I get the error "Object reference not set to an instance of an object" Hi,
that should be somewhat right assuming LinkButton has ID "LinkEdit" and it's not inside EditItemTemplate (except that if you have it declaratively there, you might want to set CausesValidation already at that point, in aspx, to avoid unnecessary state to be kept in ViewState,l when possible) Can you show how you have declared the TemplateField? Show quoteHide quote "Roberto Kohler" <rkoh***@intranetslab.com> wrote in message news:O2Nz9PWZGHA.3496@TK2MSFTNGP05.phx.gbl... > Hi, > > I have a LinkButton in a TemplateField inside my GridView > How do I access this control in the RowDataBound handler? > > I've tried this: > > Dim LinkEdit As LinkButton > If e.Row.RowType = DataControlRowType.DataRow Then > LinkEdit = e.Row.FindControl("LinkEdit") > LinkEdit.CausesValidation="true" > End If > > but it I get the error "Object reference not set to an instance of an > object" > > >
DataSourceControl and declarative SelectParameters
Javascript with Webcontrols MyGridView cause "Columes" lose the intellisense in VS2005 IDE! CompositeControl and Toolbox Print version use CSS or similar ? Sorting Datagrid Can i Make a Month Column Display May instead of 5 2.0 TreeNode How to get dynamic control's value after postback? SmartNavigation/MaintainScrollPositionOnPostback & Datagrids |
|||||||||||||||||||||||