|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Formview current RowCan anybody tell me how I can get an column from current row from
code-behind, C#. The formview is connected to an objectdatasource. Karl-Inge Hi Karl-Inge,
You can find a control within the FormViewRow by using the FindControls method, e.g. if you have an EditItemTemplate with a dropdownlist in it you can refer to it like this: DropDownList ddl = ((DropDownList)(FormView)sender).FindControl("DropDownList1"); Show quoteHide quote "Karl-Inge Reknes" wrote: > Can anybody tell me how I can get an column from current row from > code-behind, C#. > > The formview is connected to an objectdatasource. > > Karl-Inge Thanks Phillip
Karl-Inge Show quoteHide quote "Phillip Williams" wrote: > Hi Karl-Inge, > > You can find a control within the FormViewRow by using the FindControls > method, e.g. if you have an EditItemTemplate with a dropdownlist in it you > can refer to it like this: > DropDownList ddl = > ((DropDownList)(FormView)sender).FindControl("DropDownList1"); > -- > HTH, > Phillip Williams > http://www.societopia.net > http://www.webswapp.com > > > "Karl-Inge Reknes" wrote: > > > Can anybody tell me how I can get an column from current row from > > code-behind, C#. > > > > The formview is connected to an objectdatasource. > > > > Karl-Inge Hi Phillip
Your answare lead me into a another solution: String CustomerName = ((Customer)FormView)sender).CustomerName; Where Customer is the class (List<Customer>) that is return by the objectdatasource to the formview control, and CustomerName is a property of the Customer class. Thanks again! Karl-Inge Show quoteHide quote "Phillip Williams" wrote: > Hi Karl-Inge, > > You can find a control within the FormViewRow by using the FindControls > method, e.g. if you have an EditItemTemplate with a dropdownlist in it you > can refer to it like this: > DropDownList ddl = > ((DropDownList)(FormView)sender).FindControl("DropDownList1"); > -- > HTH, > Phillip Williams > http://www.societopia.net > http://www.webswapp.com > > > "Karl-Inge Reknes" wrote: > > > Can anybody tell me how I can get an column from current row from > > code-behind, C#. > > > > The formview is connected to an objectdatasource. > > > > Karl-Inge Hi Phillip
The solution I found has wrong code. Her is the corret code: string customerName = ((Customer)((FormView)((DropDownList)sender).NamingContainer).DataItem).CustomerName; Where Customer is the class (List<Customer>) that is return by the objectdatasource to the formview control, and CustomerName is a property of the Customer class. Karl-Inge Show quoteHide quote "Karl-Inge Reknes" wrote: > Hi Phillip > > Your answare lead me into a another solution: > > String CustomerName = ((Customer)FormView)sender).CustomerName; > > Where Customer is the class (List<Customer>) that is return by the > objectdatasource to the formview control, and CustomerName is a property of > the Customer class. > > Thanks again! > > Karl-Inge > > > "Phillip Williams" wrote: > > > Hi Karl-Inge, > > > > You can find a control within the FormViewRow by using the FindControls > > method, e.g. if you have an EditItemTemplate with a dropdownlist in it you > > can refer to it like this: > > DropDownList ddl = > > ((DropDownList)(FormView)sender).FindControl("DropDownList1"); > > -- > > HTH, > > Phillip Williams > > http://www.societopia.net > > http://www.webswapp.com > > > > > > "Karl-Inge Reknes" wrote: > > > > > Can anybody tell me how I can get an column from current row from > > > code-behind, C#. > > > > > > The formview is connected to an objectdatasource. > > > > > > Karl-Inge
Formview DropDownList bug??
validation summary not always showing message box DataGrid and ViewState Access db with login control uniqueidentifier and updating record ObjectDataSource .net 2.0 client side access. Why usercontrol won't allow Request.Cookies Login control tutorial Webparts design mode question |
|||||||||||||||||||||||