Solved

Datagrid problem

Posted on 2006-11-08
5
214 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
  • 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now