Asp.Net repeater

Asp.Net repeater

am 15.01.2008 13:25:01 von biju

In repeater control, the databinding expression like <%#
DataBinder.Eval(Container.DataItem, "au_id") %> can I can use any
variable name instead of "au_id". I need it becose i am taking this value
from several tables and there is slight difference in the name of filed
between tables. Kindly provide solution and thanks in advance
BIJU

Re: Asp.Net repeater

am 15.01.2008 13:44:55 von Aidy

In the SQL that you are getting your data from;

SELECT
A.au_id as 'a_au_id',
B.au_id as 'b_au_id'
FROM
A
JOIN B on A .....

That way your results will rename the fields "a_au_id" and "b_au_id" rather
than having two "au_id" fields.

"BIJU" wrote in message
news:C8C6A573-666D-456C-A976-49386CEF966D@microsoft.com...
> In repeater control, the databinding expression like <%#
> DataBinder.Eval(Container.DataItem, "au_id") %> can I can use any
> variable name instead of "au_id". I need it becose i am taking this value
> from several tables and there is slight difference in the name of filed
> between tables. Kindly provide solution and thanks in advance
> BIJU
>
>

Re: Asp.Net repeater

am 15.01.2008 14:26:02 von biju

Hai Aidy,
Actually the problem with me is that I have 7 tables in my database and
depends upon the users selection different table will be processed. In each
table, there are some differece in the name of the fields. But in the data
binding in the repeater control, in the HTML part I have to mention the field
name. As it is taken from diff. tables, I cant specify the field name. Kindly
provide solution

"Aidy" wrote:

> In the SQL that you are getting your data from;
>
> SELECT
> A.au_id as 'a_au_id',
> B.au_id as 'b_au_id'
> FROM
> A
> JOIN B on A .....
>
> That way your results will rename the fields "a_au_id" and "b_au_id" rather
> than having two "au_id" fields.
>
> "BIJU" wrote in message
> news:C8C6A573-666D-456C-A976-49386CEF966D@microsoft.com...
> > In repeater control, the databinding expression like <%#
> > DataBinder.Eval(Container.DataItem, "au_id") %> can I can use any
> > variable name instead of "au_id". I need it becose i am taking this value
> > from several tables and there is slight difference in the name of filed
> > between tables. Kindly provide solution and thanks in advance
> > BIJU
> >
> >
>
>
>

Re: Asp.Net repeater

am 15.01.2008 15:16:13 von Aidy

You're probably better off using code-behind and dynamically decided on what
your columns will bind to depending on your dataset. The way you are
binding now is fine for more static implementations, but not for what you
want to do.

"BIJU" wrote in message
news:D6AADFB8-99C9-4BFA-8112-73A14B4E12DD@microsoft.com...
> Hai Aidy,
> Actually the problem with me is that I have 7 tables in my database and
> depends upon the users selection different table will be processed. In
> each
> table, there are some differece in the name of the fields. But in the data
> binding in the repeater control, in the HTML part I have to mention the
> field
> name. As it is taken from diff. tables, I cant specify the field name.
> Kindly
> provide solution
>
> "Aidy" wrote:
>
>> In the SQL that you are getting your data from;
>>
>> SELECT
>> A.au_id as 'a_au_id',
>> B.au_id as 'b_au_id'
>> FROM
>> A
>> JOIN B on A .....
>>
>> That way your results will rename the fields "a_au_id" and "b_au_id"
>> rather
>> than having two "au_id" fields.
>>
>> "BIJU" wrote in message
>> news:C8C6A573-666D-456C-A976-49386CEF966D@microsoft.com...
>> > In repeater control, the databinding expression like <%#
>> > DataBinder.Eval(Container.DataItem, "au_id") %> can I can use any
>> > variable name instead of "au_id". I need it becose i am taking this
>> > value
>> > from several tables and there is slight difference in the name of filed
>> > between tables. Kindly provide solution and thanks in advance
>> > BIJU
>> >
>> >
>>
>>
>>
>

Re: Asp.Net repeater

am 15.01.2008 16:38:49 von George Ter-Saakov

Use aliases..

so it will be
SELECT field1 as a, field 2 as b FROM Table1
SELECT anotherfield1 as a, anotherfield 2 as b FROM Table1

and in your Repeater you would bind to aliases
DataBinder.Eval(Container.DataItem, "a")
DataBinder.Eval(Container.DataItem, "b")

George.


"BIJU" wrote in message
news:D6AADFB8-99C9-4BFA-8112-73A14B4E12DD@microsoft.com...
> Hai Aidy,
> Actually the problem with me is that I have 7 tables in my database and
> depends upon the users selection different table will be processed. In
> each
> table, there are some differece in the name of the fields. But in the data
> binding in the repeater control, in the HTML part I have to mention the
> field
> name. As it is taken from diff. tables, I cant specify the field name.
> Kindly
> provide solution
>
> "Aidy" wrote:
>
>> In the SQL that you are getting your data from;
>>
>> SELECT
>> A.au_id as 'a_au_id',
>> B.au_id as 'b_au_id'
>> FROM
>> A
>> JOIN B on A .....
>>
>> That way your results will rename the fields "a_au_id" and "b_au_id"
>> rather
>> than having two "au_id" fields.
>>
>> "BIJU" wrote in message
>> news:C8C6A573-666D-456C-A976-49386CEF966D@microsoft.com...
>> > In repeater control, the databinding expression like <%#
>> > DataBinder.Eval(Container.DataItem, "au_id") %> can I can use any
>> > variable name instead of "au_id". I need it becose i am taking this
>> > value
>> > from several tables and there is slight difference in the name of filed
>> > between tables. Kindly provide solution and thanks in advance
>> > BIJU
>> >
>> >
>>
>>
>>