Jquery function called from server side and needs to find a div

I have a Datalist with three columns or fields:
Column1:  Some data
Column2: Linkbutton Update
Column3: div "divCheck", by default it's hide.

<asp:DataList ID="MyDataList" runat="server" EnableViewState="True">
      <HeaderTemplate>
      </HeaderTemplate>
      <ItemTemplate>
          <table width="100%">
              <tr id="ItemRow" runat="server">
                  <td >
                      <%# DataBinder.Eval(Container.DataItem, "some_data")%>
                  </td>
                  <td >
                      <asp:LinkButton Text="Update" class="lnk_showCheck" CommandName="update" Runat="server" ID="update"   />
                  </td>
                  <td >
                      <div id="divCheck" style="display: none">Check</div>
                      
                  </td>
              </tr>
          </table>
      </ItemTemplate>

</asp:DataList>

Open in new window


The idea is that when clicking linkbutton on any row, it has to trigger a server side function and call jquery function ShowCheck.
Protected Sub MyDataList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles MyDataList.ItemCommand

        If e.CommandName = "update" Then
            Dim script As String = "<script language='javascript'> ShowCheck();</script>"
            Page.ClientScript.RegisterStartupScript(Me.[GetType](), "ShowCheck", script, False)

        End If

    End Sub

Open in new window


Jquery ShowCheck() has to show divCheck in that row.
 
<script type="text/javascript">

        function ShowCheck() {

            //alert($(this).get(0).tagName);
            $('div', $(this).closest("td").next()).show();
            };

    </script>

Open in new window

Problem is that $(this) is passed as an undefined object. It should be passed as a LinkButton object inside DataList.

Is that possible? How could jquery find divCheck in Table row when is triggered from server side function?
LVL 1
miyahiraAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
That code is not going to work because you are using $(this) inside a function that did not originate with an event. The linkbutton would have to be passed in as a parameter something like

function showCheck(obj)
{
     $('div', $(obj).closest("td").next()).show();
}

Open in new window


However, to properly answer the question it would help to see the rendered page output - is it possible to post that or a link to the page?
miyahiraAuthor Commented:
Thanks for your input. I realized that I should pass parameters on jquery in this way:

Protected Sub MyDataList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles MyDataList.ItemCommand

        If e.CommandName = "update" Then
            Dim linkButton As LinkButton = TryCast(e.CommandSource, LinkButton)
            Page.ClientScript.RegisterStartupScript(Me.[GetType](), "Shows", "ShowCheck(" + linkButton.ClientID + ");", True)

        End If

    End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
miyahiraAuthor Commented:
Found final answer on my own.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.