[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

How to do a Client Event on a Gridview on asp.net

Hi all i ma doiugn a project wwhere i need have a click event on a gridview i need to run a query based on the details on col 0 {Staff id} and opass the data to anothe form
0
awolarczuk
Asked:
awolarczuk
  • 2
  • 2
1 Solution
 
MrunalCommented:
Hi
Can you please explain more, from client side you want to pass just parameter and aslo want to navigate on next page also?

Also do you want any link or something on which you want to click and proceed further?

0
 
awolarczukAuthor Commented:
Hi there mroonal: ithanks for getting bacl to me i want to use a gridview list and i want to be able to client on it and take the number from teh first colume of the row i client on and run pass it to a page and then from that other page run a sql query to fill in the page

Does that help
0
 
awolarczukAuthor Commented:
This is what i have but when i client on the Grid view it doenst seem to do anything


    Protected Sub gvItems_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvItems.SelectedIndexChanged
        ' Get the currently selected row using the SelectedRow property.
        Dim row As GridViewRow = gvItems.SelectedRow

        ' Display the company name from the selected row.
        ' In this example, the third column (index 2) contains
        ' the company name.

        MsgBox("You selected " & row.Cells(2).Text & ".")
    End Sub
0
 
MrunalCommented:
try this code:

<table id="ItemsContainer" class="itemsCss" border="1" cellpadding="0" cellspacing="0" width="500px">
        <tr>
        <th>        
        ItemID</th>
        <th>
        Item Name</th>
        <th>
        Item Price</th>
        <th>
        Purchase Date</th>
        </tr>
        <tr>
        <td>        
        2</td>
        <td>
        Item Name 2</td>
        <td>
        $10.00</td>
        <td>
        08/08/2011</td>
        </tr>
        <tr>
        <td>        
        3</td>
        <td>
        Item Name 3</td>
        <td>
        $50.00</td>
        <td>
        08/20/2011</td>
        </tr>
        <tr>
        <td>        
        4</td>
        <td>
        Item Name 4</td>
        <td>
        $35.00</td>
        <td>
        12/04/2011</td>
        </tr>
    </table>

==========================

add this jquery code:

$(document).ready(function () {
    GetFirstNumber();
});

function GetFirstNumber() {
    $('table.itemsCss').find('tr').each(function () {
        $(this).bind('click', function (index) {
            alert($(this).find('td:eq(0)').html());
        });
    });
}
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now