Solved

Datagrid problem

Posted on 2006-11-08
5
251 Views
Last Modified: 2010-04-23
I am running the procedure below on my vb.net page when ever the datagrid is clicked.  it is picking up the correct screenid number but when the page is viewed if the dataset has no records in it the datagrid remains keeps the same records.  Can someone tell me how to get it to switch to no records if none are returned.

Thanks

   SqlDataAdapter6.SelectCommand.Parameters("@paramid").Value = screenid
     SqlDataAdapter6.Fill(DsPAScreen61, "tblPAPhoneVoucher")
        DataGrid1.DataSource = (DsPAScreen61)
        DataGrid1.DataMember = "tblPAPhoneVoucher"
0
Comment
Question by:running32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:Xeavn
ID: 17900147
Try using

DataGrid1.DataBind()

after setting the DataSource.
0
 

Author Comment

by:running32
ID: 17900214
It tells me datagrid is not a member of form.datagrid
0
 
LVL 13

Accepted Solution

by:
newyuppie earned 500 total points
ID: 17900240
maybe the dataset is not getting cleared before the fill. try one of 2 options

1) set the ClearBeforeFill property to TRUE for the dataset

or

2)
try adding
DsPAScreen61.Clear()
before filling the dataadapter
0
 

Author Comment

by:running32
ID: 17900284
That's it thanks
0
 
LVL 13

Expert Comment

by:newyuppie
ID: 17900321
your welcome.
thanks for the grade
NY
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question