Home All Groups Group Topic Archive Search About
Author
5 Dec 2005 6:45 PM
Karl-Inge Reknes
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

Author
5 Dec 2005 9:11 PM
Phillip Williams
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
Author
6 Dec 2005 8:28 AM
Karl-Inge Reknes
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
Author
6 Dec 2005 9:03 AM
Karl-Inge Reknes
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
Author
6 Dec 2005 9:56 AM
Karl-Inge Reknes
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