Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Gridview - check select parameter

0 views
Skip to first unread message

Tony WONG

unread,
Dec 14, 2009, 3:49:40 AM12/14/09
to
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


Alexey Smirnov

unread,
Dec 14, 2009, 9:21:33 AM12/14/09
to

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

Tony WONG

unread,
Dec 15, 2009, 3:11:19 AM12/15/09
to
Thanks a lot. Alexey

"Alexey Smirnov" <alexey....@gmail.com>
???????:75d9eead-ce22-4031...@m3g2000yqf.googlegroups.com...

Alexey Smirnov

unread,
Dec 15, 2009, 4:54:51 AM12/15/09
to
On Dec 15, 9:11 am, "Tony WONG" <x...@netvigator.com> wrote:
> Thanks a lot.  Alexey
>
> "Alexey Smirnov" <alexey.smir...@gmail.com>
> ???????:75d9eead-ce22-4031-81ea-9db4fe753...@m3g2000yqf.googlegroups.com...
> 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

0 new messages