Gridview - check select parameter

T

Tony WONG

the gridview is filtered by a textbox

when the user inputs 2009-1782 in the textbox

then the gridview shows the record numbered 1782

String before hypen is irrelevant, then a button event is used to erase
"2009-" in the textbox
***********
If InStr(SearchNo.Text, "-") = True Then
SearchNo.Text = Right(SearchNo.Text, len(SearchNo)-5)
GridView1.DataBind()
End If
************

but page error, it seems select command fires before change of textbox

What's the best way to do validating select parameters for the gridview?

Thanks a lot.

tony
 
G

Guest

the gridview is filtered by a textbox

when the user inputs 2009-1782 in the textbox

then the gridview shows the record numbered 1782

String before hypen is irrelevant, then a button event is used to erase
"2009-" in the textbox
***********
        If InStr(SearchNo.Text, "-") = True Then
            SearchNo.Text = Right(SearchNo.Text, len(SearchNo)-5)
            GridView1.DataBind()
        End If
************

but page error, it seems select command fires before change of textbox

What's the best way to do validating select parameters for the gridview?

Thanks a lot.

tony

Hi Tony,

I believe that the error is about type mismatch. First of all, InStr
returns integer and not boolean, change to

If InStr(SearchNo.Text, "-") > -1 Then

then change len(SearchNo)

to len(SearchNo.Text)

Hope this helps
 
T

Tony WONG

Thanks a lot. Alexey

"Anon User" <>
???????:[email protected]...
the gridview is filtered by a textbox

when the user inputs 2009-1782 in the textbox

then the gridview shows the record numbered 1782

String before hypen is irrelevant, then a button event is used to erase
"2009-" in the textbox
***********
If InStr(SearchNo.Text, "-") = True Then
SearchNo.Text = Right(SearchNo.Text, len(SearchNo)-5)
GridView1.DataBind()
End If
************

but page error, it seems select command fires before change of textbox

What's the best way to do validating select parameters for the gridview?

Thanks a lot.

tony

Hi Tony,

I believe that the error is about type mismatch. First of all, InStr
returns integer and not boolean, change to

If InStr(SearchNo.Text, "-") > -1 Then

then change len(SearchNo)

to len(SearchNo.Text)

Hope this helps
 
G

Guest

Thanks a lot.  Alexey

"Anon User" <[email protected]>
???????:[email protected]....









Hi Tony,

I believe that the error is about type mismatch. First of all, InStr
returns integer and not boolean, change to

If InStr(SearchNo.Text, "-") > -1 Then

then change len(SearchNo)

to len(SearchNo.Text)

Hope this helps- Hide quoted text -

- Show quoted text -

Glad it helps. It always useful to see what error message system
returns. In most cases a message tells exactly what the problem is. If
you have just "an application error" then set customErrors mode to Off

http://msdn.microsoft.com/en-us/library/h0hfz6fc.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top