Datagrid Problem

G

Guest

Dear All,


I have a datagrid which displays the column of Names of doctors.When I
use e.item.cell(5).Text. I see the name of two doctors instead of
one.In
the database the doctors name are:

James,Wilson
Richard,Clark
Jamie,Clark

when I do response.write( e.item.cell(5).Text) in my update event it
outputs the following concated values

James,WilsonRichard,Clark

which I dont want. I want a single name to be appeared

Any help much appreciated.

cheers,
Sunil Sabir
 
R

Raghavendra T V

Hi Sunil,

Instead of doing a response.write you can put a break point at the place
where you are accessing
e.item.cell(5) and check the value.

if you are still getting 2 names in cell(5) then verify how you are
databinding the Grid column to Data.

if this is also correct then check the SQL Query you have written to get
this data by manually running in Query analyser.

[I guess you have 2 names in DB in that column!]

I know my solution is not the right one but still you can try what i have
told.

Thanks
Raghavendra
 
F

Frank Mamone

I believe he meant to insert a "breakpoint" and then run your page in Debug
mode. There you'll be able to check the value.

Are you using Visual Studio or Web Matrix?


- Frank


Sunil Sabir said:
Hi Raghavendra ,

Thanks for your advice. I used e.item.cell(5).text "<br>". This time its
showing
something like this

James,Wilson
Richard,Clark

I mean it just shows the record on the next line.Before it was showing on the
same line. What I need is that It should show only James,Wilson. And one more
thing James and Wilson are 2 separated columns in the database. I am concating
them first and then retrieving them in the Datagrid

First_Name + ',' + Last_Name

Any help much appreciated.

cheers,
Sunil


Raghavendra T V said:
Hi Sunil,

Instead of doing a response.write you can put a break point at the place
where you are accessing
e.item.cell(5) and check the value.

if you are still getting 2 names in cell(5) then verify how you are
databinding the Grid column to Data.

if this is also correct then check the SQL Query you have written to get
this data by manually running in Query analyser.

[I guess you have 2 names in DB in that column!]

I know my solution is not the right one but still you can try what i have
told.

Thanks
Raghavendra

Sunil Sabir said:
Dear All,


I have a datagrid which displays the column of Names of doctors.When I
use e.item.cell(5).Text. I see the name of two doctors instead of
one.In
the database the doctors name are:

James,Wilson
Richard,Clark
Jamie,Clark

when I do response.write( e.item.cell(5).Text) in my update
event
it
outputs the following concated values

James,WilsonRichard,Clark

which I dont want. I want a single name to be appeared

Any help much appreciated.

cheers,
Sunil Sabir
 
A

Ather Ali Shaikh

you have to use in ItemDataBound as

e.item.cell(5).Text = e.item.dataitem("FirstName") + "<br>" + e.item.dataitem("LastName")


Regards
Ather

Frank Mamone said:
I believe he meant to insert a "breakpoint" and then run your page in Debug
mode. There you'll be able to check the value.

Are you using Visual Studio or Web Matrix?


- Frank


Sunil Sabir said:
Hi Raghavendra ,

Thanks for your advice. I used e.item.cell(5).text "<br>". This time its
showing
something like this

James,Wilson
Richard,Clark

I mean it just shows the record on the next line.Before it was showing on the
same line. What I need is that It should show only James,Wilson. And one more
thing James and Wilson are 2 separated columns in the database. I am concating
them first and then retrieving them in the Datagrid

First_Name + ',' + Last_Name

Any help much appreciated.

cheers,
Sunil


Raghavendra T V said:
Hi Sunil,

Instead of doing a response.write you can put a break point at the place
where you are accessing
e.item.cell(5) and check the value.

if you are still getting 2 names in cell(5) then verify how you are
databinding the Grid column to Data.

if this is also correct then check the SQL Query you have written to get
this data by manually running in Query analyser.

[I guess you have 2 names in DB in that column!]

I know my solution is not the right one but still you can try what i have
told.

Thanks
Raghavendra

Dear All,


I have a datagrid which displays the column of Names of
doctors.When I
use e.item.cell(5).Text. I see the name of two doctors instead of
one.In
the database the doctors name are:

James,Wilson
Richard,Clark
Jamie,Clark

when I do response.write( e.item.cell(5).Text) in my update event
it
outputs the following concated values

James,WilsonRichard,Clark

which I dont want. I want a single name to be appeared

Any help much appreciated.

cheers,
Sunil Sabir
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,616
Members
45,305
Latest member
KetoMeltsupplement

Latest Threads

Top