|
-
Sep 10th, 2007, 06:43 PM
#1
Thread Starter
Member
Using a Filter Expression in an SqlDataSource for an Integer Value
I have a gridview bound to a sqldatasource with a select command that selects from a table. When a user selects a row in that grid, my formview control should populate with that row's info. My formview is bound to another sqldatasource which has the same select command as the first sqldatasource but it has a filterexpression based on the value of a column from the selected row. The problem is that the column that I'm using the filterexpression on is an int32 (the column in the db is an identity seed) so as soon as I select the row from the gridview, I get the following error: "Cannot perform '=' operation on System.Int32 and System.String." Ok, I get that. It's looking for a string value and I'm giving it an Int32. So how do I fix this? I was able to capture the value on the GridView1_SelectedIndexChanged event (SqlDataSource2.filterexpression="c_entry='" & GridView1.SelectedRow.Cells(8).Text & "'". But I'm guessing this is a fairly common issue so there's got to be a way to get it to work without capturing the event and feeding it the value. So what's the secret?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|