Search code examples
c#jqueryasp.netxsltektron

How to change style of content a XSL file using C#/JQuery


if the value of spnCity is "ABC" then set id1 to class (tableHeading) otherwise set id1 to class (tableHeading2)

How can I access the spnCity span from code-behind in my Web Handler or if that is not possible, how do I access it using JQuery.

My preference is to really use C# code-behind because I have a function which does some complex operation.

DateTime now = DateTime.Now;
//DateTime test = DateTime.Now.AddHours(8);
string time = now.ToString("T");

static public bool IsTimeOfDayBetween(DateTime time, TimeSpan startTime, TimeSpan endTime)
{
    if (endTime == startTime)
    {
        return true;
    }
    else if (endTime < startTime)
    {
        return time.TimeOfDay <= endTime ||
            time.TimeOfDay >= startTime;
    }
    else
    {
        return time.TimeOfDay >= startTime &&
            time.TimeOfDay <= endTime;
    }

}

Solution

  • Since you asked if that is not possible, how do I access it using JQuery., i am writing answer to access that using jquery. Following is jQuery code to access that span value.

    $("#id1 h4 span").text().trim()