[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 734
  • Last Modified:

DetailsView linked to GridView on accessdatasource. DetailsView disappears when select used

I've seen lots of people mentioning this problem, but still I haven't been able to figure out how to fix it.

Basically I am trying to implement the scenario mentioned in 'http://aspalliance.com/539'. They say that you can't addrows using the gridview on an access database, and so you have to use the detailsview in association with the gridview as they mention in their article.

So, I can get all that working fine, gridview is displayed, and detailsview is displayed and populated. But, when I go to use the 'Select' command on one of the rows of the GridView, instead of the DetailsView being populated with the new data, the DetailsView disappears altogether.

Now, this is probably because the DetailsView is not being populated at all. But, either way, I don't know how to fix it, I did not alter the project downloaded from 'http://aspalliance.com/539', but that's what happened. I've heard that it might have something to do with the DetailsView not being bound to the datasource on postback... but still, I'm not sure how to fix this.

Can anyone help?
0
AidenA
Asked:
AidenA
  • 2
  • 2
1 Solution
 
GreymanMSCCommented:
They've supplied the wrong format for the FilterExpression, which is built using String Format placeholders rather than the Parameters used by the 'Commands.

These placeholders are numbered, with 0 representing the first parameter in the FilterParameters collection, and so forth.  You specify the placeholder in the string by using set brackets around the index.  You further delimiting them by quotes if (and only if) the datatype is a string.

It's confusing and annoying, is it not?




  FilterExpression="au_id='{0}'"

Open in new window

0
 
AidenAAuthor Commented:
Hi, it's a bit irritating alright when something that looks like it should be easy ends up taking ages to solve! I think it would have taken me forever to figure that one out.

I'll accept that solution. But, I was just wondering if you might off hand have any idea about a related problem I have (I can open a new question if you do).

Obviously I'm applying the techniques listed in that webpage to my own project. But something inexplicable is happening. The Update query does nothing. It seems to happen when I use the ? symbol as in the queries shown below. I need to use the ? symbol to make changes to the row that I'm editing (I presume you know already, but the ? symbol specifies that you use the data that is already there for that selection, so you can input data and then use that data to update to the table).

But what's weirder, is that it works perfectly in the project I downloaded from 'http://aspalliance.com/539'. Everything looks fine... and I cannot see a difference between what they have done and what I have done. In fact, I basically used their objects and transferred the data from my table into theirs, deleting all their data of course and changing the queries to suit me... and it worked perfectly, the second query below worked fine! But, today I open it up again... and it is not working again?

Totally confused about that one also? Any ideas? (I will start a new question so let me know if you want me to do that)
This works:
 
UPDATE [User Information] SET [User Name] = ? WHERE (ID ='1234')
 
This does not work:
 
UPDATE [User Information] SET [User Name] = ? WHERE (ID = ?)

Open in new window

0
 
GreymanMSCCommented:
I'd need a bit more to go on.  The query itself looks perfectly fine, so the problem would lie either in the rest of the AccessDataSource, or the container that databinds with it.
0
 
AidenAAuthor Commented:
Yeah, I have no idea what could be wrong with this. Don't have enough experience with web programming yet.

I created a new question for it 'Simple Gridview Update query on accessdatasource not working' although this website did not allow me to attach a .aspx file to show the problem.

If you can take a look or give me an idea about how to proceed that would be great.
0

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now