Table tr td n-th-child with jQuery 'Hide/Show' magic

 

$('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
    var getcurrent = $(this).text();
    var i = 0;
    $('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
        if ($(this).text() == getcurrent) {
            $(this).css('color', 'red');
            
            if (i > 0) {
                $(this).hide();
                $("#SktchBlkDtlsTabel").find("tr:contains(" + getcurrent + ")").hide();
                //$(this).parent.parent.find("tr:contains(" + getcurrent + ")").hide();
            }
            i = i + 1;
        }
    });
});


$('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
    var getcurrent = $(this).text();
    var i = 0;
    $('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
        if ($(this).text() == getcurrent) {
            $(this).css('color', 'red');

            if (i > 0) {
                $(this).parent('tr').hide();
                //$("#SktchBlkDtlsTabel").find("tr:contains(" + getcurrent + ")").hide();
                //$(this).parent.parent.find("tr:contains(" + getcurrent + ")").hide();
            }
            i = i + 1;
        }
    });
});


$('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
    var getcurrent = $(this).text();
    var i = 0;
    $('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
        if ($(this).text() == getcurrent) {
            $(this).css('color', 'red');

            if (i > 0) {
                $(this).parent('tr td:nth-child(3)').hide();
                $(this).parent('tr td:nth-child(4)').hide();
                $(this).parent('tr td:nth-child(5)').hide();
                $(this).parent('tr td:nth-child(6)').hide();
                $(this).parent('tr td:nth-child(7)').hide();
                //$("#SktchBlkDtlsTabel").find("tr:contains(" + getcurrent + ")").hide();
                //$(this).parent.parent.find("tr:contains(" + getcurrent + ")").hide();
            }
            i = i + 1;
        }
    });
});


$('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
    var getcurrent = $(this).text();
    var i = 0;
    $('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
        if ($(this).text() == getcurrent) {
            $(this).css('color', 'red');

            if (i > 0) {
                $(this).parent('tr').find('td:nth-child(3)').hide();
                $(this).parent('tr').find('td:nth-child(4)').hide();
                $(this).parent('tr').find('td:nth-child(5)').hide();
                $(this).parent('tr').find('td:nth-child(6)').hide();
                $(this).parent('tr').find('td:nth-child(7)').hide();
----------
$('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
    var getcurrent = $(this).text();
    var i = 0;
    $('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
        if ($(this).text() == getcurrent) {
            $(this).css('color', 'red');

            if (i > 0) {
                $(this).parent('tr').find('td:nth-child(3)').hide();
                $(this).parent('tr').find('td:nth-child(4)').hide();
                $(this).parent('tr').find('td:nth-child(5)').hide();
                $(this).parent('tr').find('td:nth-child(6)').hide();
                $(this).parent('tr').find('td:nth-child(7)').hide();
                $(this).parent('tr').find('td:nth-child(8)').hide();
                $(this).parent('tr').find('td:nth-child(9)').hide();
                $(this).parent('tr').find('td:nth-child(10)').hide();
                //$("#SktchBlkDtlsTabel").find("tr:contains(" + getcurrent + ")").hide();
                //$(this).parent.parent.find("tr:contains(" + getcurrent + ")").hide();
            }
            i = i + 1;
        }
    });
});






Change Gridview Header Text


$('#ContentPlaceHolder1_gvDashBoard tbody tr th:nth-child(1)').html("NewText");

Call Web Service | SOAP | WSDL | asmx

Here ParameterService is a Service name on references and ParameterServiceSoapClient is a class name on autogenerated file  reference.cs .



 public void TestMethod()

        {

            try

            {

ParameterService.ParameterServiceSoapClient FObjFetchParameters = new                     ParameterService.ParameterServiceSoapClient();

                DataSet dtSurnoc = new DataSet();

               dtSurnoc = FObjFetchParameters.GetSNo(24,1,3,5,12);

              }

            catch (Exception ex)

            {

                throw;

            }

        }

c# read all table with column dataset / datatable

foreach (DataTable dtab in ds.Tables)
                    {
                       Console.WriteLine("Table - "+dtab.TableName);
                        foreach (DataColumn dc in dtab.Columns)
                        Console.WriteLine("Col- "+dc.ColumnName);
                    }

GridView - Selected row data using datakey name | Asp.Net c#


GridView - Dynamic Select Button  | Asp.Net c#


Home.aspx

asp:GridView runat="server" ID="GrdLandDetails" CssClass="table table-striped table-bordered table-hover gridasp" PageSize="10" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="id,age"  AutoGenerateSelectButton="true" OnSelectedIndexChanging="GrdLandDetails_SelectedIndexChanging"
                                             
  Columns
                                                    asp:BoundField HeaderText="Name" DataField="Sname"
                                                    asp:BoundField HeaderText="Amount" DataField="amt"
                                                    asp:


Home.aspx.cs  | Code Behind

  protected void gv_bindowners_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
  {
         string Fname = gv_bindowners.DataKeys[e.NewSelectedIndex].Values["Sname"].toString;
         string Age = gv_bindowners.DataKeys[e.NewSelectedIndex].Values["age"].toString;
         string Amount = gv_bindowners.DataKeys[e.NewSelectedIndex].Values["amt"].toString;
  }




                                             

Advanced Add Reference - capicom.dll

Add Assembly References in Asp.Net Visual Studio

Step1: Put capicom.dll in any drive.

Step2:  open cmd as administrator.

Step3:


Step4: Open Visual Studio on Solution Explorer, Add Reference



Social Media