Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Button click & filtering a GridView

Reply
Thread Tools

Button click & filtering a GridView

 
 
Jokke
Guest
Posts: n/a
 
      04-02-2010
Hi,

* Click event doesn't fire?

On clicking a button, my gridview should be filtered with the value typed in
a textbox.

It works, but only the second time you click the button. First click ->
nothing.

To be on the safe side, I already removed the button and put another one
there (with other name), but the behavior still stands.

I am a first timer in ASP.NET, so I must be missing something. I tried
debugging, and the click event simply doesn't fire the first time you click
the button... Please advise!

the code is:

Protected Sub btnFilterSupplName_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles btnFilterSupplName.Click
SqlDataSource2.FilterExpression = "[SupplierName] LIKE '%" &
Me.txtSearchSupplName.Text & "%'"
Me.GridView1.DataBind()
End Sub

* Selecting the first GridView record

The GridView has a Select column, and a Details View control is bound to it
If the textbox/button filtering yields results in the GridView, I would like
the DetailsView to display the first record in the GridView, as if the user
had clicked on the Select of the first GridView record.
How can I do this?

thank you for your help!

 
Reply With Quote
 
 
 
 
James VanDyne
Guest
Posts: n/a
 
      04-02-2010
Can you post the code where you are telling the button about this event
handler? For example, are you setting Click="btnFilterSupplName_Click" in
the HTML markup or are you maybe doing this in a Page Load event, etc...


"Jokke" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> * Click event doesn't fire?
>
> On clicking a button, my gridview should be filtered with the value typed
> in a textbox.
>
> It works, but only the second time you click the button. First click ->
> nothing.
>
> To be on the safe side, I already removed the button and put another one
> there (with other name), but the behavior still stands.
>
> I am a first timer in ASP.NET, so I must be missing something. I tried
> debugging, and the click event simply doesn't fire the first time you
> click the button... Please advise!
>
> the code is:
>
> Protected Sub btnFilterSupplName_Click(ByVal sender As Object, ByVal e
> As System.EventArgs) Handles btnFilterSupplName.Click
> SqlDataSource2.FilterExpression = "[SupplierName] LIKE '%" &
> Me.txtSearchSupplName.Text & "%'"
> Me.GridView1.DataBind()
> End Sub
>
> * Selecting the first GridView record
>
> The GridView has a Select column, and a Details View control is bound to
> it
> If the textbox/button filtering yields results in the GridView, I would
> like the DetailsView to display the first record in the GridView, as if
> the user had clicked on the Select of the first GridView record.
> How can I do this?
>
> thank you for your help!


 
Reply With Quote
 
 
 
 
Jokke
Guest
Posts: n/a
 
      04-06-2010
It is the button click event alright.

btnFilterSCode_Click

Actually happens with 2 buttons, on their respective click events...

Thx for helping.


"James VanDyne" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Can you post the code where you are telling the button about this event
> handler? For example, are you setting Click="btnFilterSupplName_Click" in
> the HTML markup or are you maybe doing this in a Page Load event, etc...
>
>
> "Jokke" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi,
>>
>> * Click event doesn't fire?
>>
>> On clicking a button, my gridview should be filtered with the value typed
>> in a textbox.
>>
>> It works, but only the second time you click the button. First click ->
>> nothing.
>>
>> To be on the safe side, I already removed the button and put another one
>> there (with other name), but the behavior still stands.
>>
>> I am a first timer in ASP.NET, so I must be missing something. I tried
>> debugging, and the click event simply doesn't fire the first time you
>> click the button... Please advise!
>>
>> the code is:
>>
>> Protected Sub btnFilterSupplName_Click(ByVal sender As Object, ByVal e
>> As System.EventArgs) Handles btnFilterSupplName.Click
>> SqlDataSource2.FilterExpression = "[SupplierName] LIKE '%" &
>> Me.txtSearchSupplName.Text & "%'"
>> Me.GridView1.DataBind()
>> End Sub
>>
>> * Selecting the first GridView record
>>
>> The GridView has a Select column, and a Details View control is bound to
>> it
>> If the textbox/button filtering yields results in the GridView, I would
>> like the DetailsView to display the first record in the GridView, as if
>> the user had clicked on the Select of the first GridView record.
>> How can I do this?
>>
>> thank you for your help!

>


 
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
How to fire both event button click and textchanged when button is click and text is changed Amy ASP .Net 0 06-01-2006 02:33 PM
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net Building Controls 1 05-28-2004 06:23 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net 2 05-25-2004 11:45 PM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net Datagrid Control 0 05-25-2004 01:45 AM



Advertisments