Error in gridview displaying-rectify

Posted by Oswaldlily under ASP.NET on 3/13/2012 | Points: 10 | Views : 819 | Status : [Member] | Replies : 3
My select query goes lik this

Select a.name,a.id,a.dept,b.customer,b.price from tablename a(nolock)
left outer join tablename2 b(Nolock).......
now i m calling this in gridview.

<asp:gridview runat="server" id="gv" autogeneratecolumns="false">
<columns>
<asp:TemplateField HeaderText="column1">
<ItemTemplate>
<asp:Label ID="lbl1" runat="server" Text='<%#Eval("name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="column2">
<ItemTemplate>
<asp:Label ID="lbl2" runat="server" Text='<%#Eval("id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="column3">
<ItemTemplate>
<asp:Label ID="lbl3" runat="server" Text='<%#Eval("customer") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</columns>
</gridview>

in this gridview name and id values gets displayed..
But customer which belongs to second table doesn't giving any values..
why this not working?




Responses

Posted by: Hmanjarawala on: 3/13/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi,
Plz check resultant DataSource of that query and make sure in that Datasource there is a field named "customer"
as of now your code seems Ok....

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 3/13/2012 [Member] Silver | Points: 25

Up
0
Down
Can you attach your table scripts and values?
select * from tablename
select * from tablename2

Thanks,
Sanjay

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 3/15/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

first just see the result return by your query by debugging or response.write() and then you will get to know where is the problem

Thanks


R D Patel

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response