Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Gridview - check select parameter

Reply
Thread Tools

Gridview - check select parameter

 
 
Tony WONG
Guest
Posts: n/a
 
      12-14-2009
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


 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      12-14-2009
On Dec 14, 9:49*am, "Tony WONG" <(E-Mail Removed)> wrote:
> 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
 
Reply With Quote
 
 
 
 
Tony WONG
Guest
Posts: n/a
 
      12-15-2009
Thanks a lot. Alexey

"Alexey Smirnov" <(E-Mail Removed)>
???????:(E-Mail Removed)...
On Dec 14, 9:49 am, "Tony WONG" <(E-Mail Removed)> wrote:
> 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


 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      12-15-2009
On Dec 15, 9:11*am, "Tony WONG" <(E-Mail Removed)> wrote:
> Thanks a lot. *Alexey
>
> "Alexey Smirnov" <(E-Mail Removed)>
> ???????:(E-Mail Removed)....
> On Dec 14, 9:49 am, "Tony WONG" <(E-Mail Removed)> wrote:
>
>
>
>
>
> > 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- 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
select gridview row without using select button? =?Utf-8?B?RGFiYmxlcg==?= ASP .Net 5 02-27-2009 02:56 AM
dropdownlist as templatefield needs outer gridview's row value as select parameter Managed Code ASP .Net Web Controls 0 06-14-2006 06:03 PM
dropdownlist as templatefield needs outer gridview's row value as select parameter Managed Code ASP .Net 0 06-14-2006 06:03 PM
select all check boxes at a time with check all [Javascript] [Chatakondu Gallery] Suresh Javascript 2 04-22-2004 03:47 PM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM



Advertisments