I have a code behind function that gives me a button id. Now I want to hide that particular button using jQuery. Here is my code behind

if (dt.Rows.Count > 0) {
    for (int i = 2; i < dt.Columns.Count; i++) {
        int status = Convert.ToInt32(dt.Rows[0][i].ToString());
        if (status == 1) {
            string columnname = dt.Columns[i].ToString(); //here column name is button id
            ClientScript.RegisterStartupScript(this.GetType(), "getid", "getid('" + columnname + "');", true);
        }
    }
}

Here's the jQuery function that I failed to make:

$(document).ready(function () {
    function getid(id){
        $(id).toggle('hide');
    } 
});

in my requirement i entered HTML content using HTML editor then i want to save that entered content in directory folders with extension of .HTML. i am using this wysiwyg editor in asp.net. please help me to solve this solution thanks in advance

This is how I declare the variable which stores my DateTime.

private static  System.DateTime columndate_defaultValue = System.DateTime.Now;

And this is how I update my table when I click a button from my aspx web page:

SqlCommand cmd = new SqlCommand("UPDATE TBL_RETETA_TRANDAFIR SET TradTempSol=@TradTempSol, TradTempAir=@TradTempAir, DateTime=@DateTime", connection);
cmd.Parameters.AddWithValue("@DateTime", columndate_defaultValue);

My problem is that when I click the second time on the update button, the values are updated, but the DateTime remains the same as when pressed the first time the update button.

To understand beeter my problem: Let's say I make the first update on 2016-04-04 12:44:15.

If after 5 minutes I want to make a new update, the DateTime is the same: 2016-04-04 12:44:15.

What am I doing wrong?

Data layout

What's the easiest way to reformat data shown in the second view ? I use .Net in the backend and Angular in the frontend. I have a method that returns collection of attendances that has a collection of users with their statuses, and I can filter them to only query data in a date range. I have no idea how to get the same data to get shown by users, since database structure is as follows: Training has many schedules. Schedules have Many Attendances. Attendances have many Attendants and every Attendant has his status.

Now its easy to show data by attendances, but its impossible for me to figure out how to show data by attendants(users) to show all their attendances.

Is there any example someone could provide on something similar and how to do it in Asp, or angular.

I have tried creating new dto models, but I cant get neccessary data without using many queries, and mapping data too many times.

I have searched similar questions but didn't find anything relevant.

EDIT: I am looking for the simplest solution. I would like to know how to solve this both ways, and I can't decide which way is better ? Here is the current method, which works for the first view:

 public ICollection<AttendanceModel> ScheduleLog(int scheduleId, SearchAttendancesModel searchAttendances)
    {

        if (searchAttendances == null)
            throw new ArgumentNullException("searchAttendances");
        if (searchAttendances.Attendants == null)
            throw new ArgumentNullException("searchAttendances.Attendants");
        if (searchAttendances.AttendantStatuses == null)
            throw new ArgumentNullException("searchAttendances.AttendantStatuses");
        var query = _context
                        .Attendances
                        .Where(x=>x.ScheduleId==scheduleId)
                        .AsQueryable();
        if (searchAttendances.FromDate != DateTime.MinValue)
        {
            query = query.
                    Where(x => x.Date >= searchAttendances.FromDate);
        }
        if (searchAttendances.ToDate != DateTime.MinValue)
        {
            query = query.
                    Where(x => x.Date <= searchAttendances.ToDate);
        }

        return query.ToList().Select(x => x.MapToAttendanceModel()).ToList();
    }

It gets me the neccesary data to show for the first view, which I can easily show with tables thoru ng-repeat, but as I already said, I have many difficulties grouping data by user instead of by schedule, and then showing that data(all attendances per user) instead of all users per attendance. Here is how my models look like:

This is schedule that has all the attendances:

public class ScheduleModel
{
    public int Id { get; set; }

    [Required]
    public DateTime StartDate { get; set; }

    [Required]
    public DateTime EndDate { get; set; }
    public string Description { get; set; }
    public virtual ICollection<AttendanceModel> Attendances { get; set; }
}

This is attendance that has date for attendance and collection of attendants each of which have user and their status.

public class AttendanceModel
{
    public int Id { get; set; }
    [Required]
    public DateTime Date { get; set; }
    [Required]
    public virtual ICollection<AttendantModel> Attendants { get; set; }
}

This is one Attendant that has user and status for that attendance

public class AttendantModel
{
    public int Id { get; set; }
    public virtual LookupModel ApplicantStatus { get; set; }
    public virtual UserModel User { get; set; }
}

I had created the report using report viewer in asp.net. But recently I found that it happen some error when I tried to open the excel(xlsx) file after i download. It came out with the error message "We found a problem with some content in 'Reportest(34).xlsx'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.

After I click Yes, it have another message box pop out which is said Replaced Part: /xl/worksheets/sheet1.xml part with XML error. Illegal xml character. Line 3, column 28935. Picture1

I had tried to zip it and already find out the reason why it is error. I found that the error is because of the unreadable character in the line 28935 picture2

How do I handle this error using the error. Is that my excel version? Because previously it is working fine. Please help me to solve this problem.

Thank you

Best Regards, Choo

I am incorporating cal-heatmap in my asp.net website and all works fine as long as i am referencing data through an array, initialized as variable above the init method, however things stop showing up as soon as i create new text file in visual studio and rename it as datas-years.json and reference it in 'data' attribute, please help me ?

below is the working code, manually entered data in array and referencing enter image description here

var cal = new CalHeatMap();
var data = { "1420498800": 20, "1420585200": 40, "1420671600": 60, "1420758000": 1, "1421103600": 2, "1421190000": 90, "1421276400": 1, "1421362800": 1, "1421622000": 1, "1421708400": 1, "1422226800": 1, "1422313200": 1, "1422399600": 2, "1422486000": 1, "1422572400": 1, "1423695600": 3, "1424127600": 2, "1424214000": 1, "1424300400": 3, "1424386800": 1, "1424646000": 2, "1424732400": 1, "1424818800": 2, "1424905200": 2, "1424991600": 1, "1425337200": 1, "1425855600": 4, "1426201200": 2, "1426460400": 2, "1426546800": 1, "1426633200": 2, "1426719600": 1, "1426806000": 1, "1427065200": 1, "1427151600": 1, "1427238000": 2, "1427324400": 1, "1427670000": 2, "1428361200": 2, "1428447600": 2, "1428534000": 3, "1428620400": 3, "1428966000": 2, "1429138800": 2, "1429225200": 1, "1429484400": 2, "1429570800": 1, "1429657200": 2, "1429743600": 2, "1429830000": 3 };

cal.init({
    data: data,
    itemName: ["volunteer", "volunteers"],
    start: new Date(2015, 0, 1, 1),
    domain: "month",
    subDomain: "day",
    cellSize: 15,
    subDomainTextFormat: "%d",
    range: 12,
    legend: [20, 40, 60, 80],


});

below is the referencing through separate file, all under visual studio

not working

var cal = new CalHeatMap();

cal.init({

    datatype:JSON,
    data: "datas-years.json",
    itemName: ["volunteer", "volunteers"],
    start: new Date(2015, 0, 1, 1),
    domain: "month",
    subDomain: "day",
    cellSize: 15,
    subDomainTextFormat: "%d",
    range: 12,
    //highlight: new Date(2016, 1, 15),
    legend: [20, 40, 60, 80],


});

I also would like to know what is the best way to convert the date to seconds format, when i impliment it in live, should i ensure that it is added in seconds format to json file or it can be just like 2/26/2015 ? and then convert it into seconds while borrowing from json file ? Please guide me, thank you

EDIT:

Data in the datas-years.json file in directory

[{ "1420498800":20, "1420585200":40, "1420671600":80, "1421708400": 1, "1422226800": 1, "1422313200": 1, "1422399600": 2, "1422486000": 1 }]

I am generating a report using ASP.NET. The report has different names in staging and production. IF there is a way to get my current environment(staging or production), then using IF condition I can change the report name for staging and production. Kindly help me in finding the environment or connectionstring name from code behind.

I have a webservice programmed in asp.net . I want to reach webservice from android application using SOAP(ksoap2) .

   public class MainActivity extends AppCompatActivity {

    ProgressBar pg;
    String spin1;
    String spin2;
    String spin3;
    String displayText;
    TextView tv;
    int day, month, year;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Spinner spinner1 = (Spinner) findViewById(R.id.spinner1);
        Spinner spinner2 = (Spinner) findViewById(R.id.spinner2);
        Spinner spinner3 = (Spinner) findViewById(R.id.spinner3);
        pg = (ProgressBar) findViewById(R.id.progressBar1);
        spin1 =  spinner1.getSelectedItem().toString();
        spin2 =  spinner2.getSelectedItem().toString();
        spin3 =  spinner3.getSelectedItem().toString();
        tv = (TextView) findViewById(R.id.resultbox);

        //Search
        Button btn_search=(Button)findViewById(R.id.btn_search);
        btn_search.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //Create instance for AsyncCallWS
                AsyncCallWS task = new AsyncCallWS();
                //Call execute
                task.execute();
            }
        });
    }
}

private class AsyncCallWS extends AsyncTask<String, Void, Void> {
    @Override
    protected Void doInBackground(String... params) {
        //Invoke webservice
        displayText = WebService.invokeHelloWorldWS(spin2,spin3,spin1,"search_availability");
        return null;
    }

    @Override
    protected void onPostExecute(Void result) {
        //Set response
        tv.setText(displayText);
        //Make ProgressBar invisible
        pg.setVisibility(View.INVISIBLE);
    }

    @Override
    protected void onPreExecute() {
        //Make ProgressBar invisible
        pg.setVisibility(View.VISIBLE);
    }

    @Override
    protected void onProgressUpdate(Void... values) {
    }

}

    public class WebService {

    //Namespace of the Webservice - It is http://tempuri.org for .NET webservice
    private static String NAMESPACE = "http://tempuri.org/";
    //Webservice URL - It is asmx file location hosted in the server in case of .Net
    //Change the IP address to your machine IP address or 1
    private static String URL = "https://www.channelpro.de/IBE_Android_Test/Service.asmx";
    //SOAP Action URI again http://tempuri.org
    private static String SOAP_ACTION = "http://tempuri.org/";

    public static String invokeHelloWorldWS(String person,String child ,String rooms, String webMethName) {

        String resTxt = null;
        // Create request
        SoapObject request = new SoapObject(NAMESPACE, webMethName);
        // Property which holds input parameters
        PropertyInfo sayHelloPI = new PropertyInfo();
        // Set Name
        sayHelloPI.setName("person");
        // Set Value
        sayHelloPI.setValue(person);
        // Set dataType
        sayHelloPI.setType(String.class);
        // Add the property to request object
        request.addProperty(sayHelloPI);

        PropertyInfo sayHelloPI2 = new PropertyInfo();
        // Set Name
        sayHelloPI2.setName("child");
        // Set Value
        sayHelloPI2.setValue(child);
        // Set dataType
        sayHelloPI2.setType(String.class);
        // Add the property to request object
        request.addProperty(sayHelloPI2);

        PropertyInfo sayHelloPI3 = new PropertyInfo();
        // Set Name
        sayHelloPI3.setName("rooms");
        // Set Value
        sayHelloPI3.setValue(rooms);
        // Set dataType
        sayHelloPI3.setType(String.class);
        // Add the property to request object
        request.addProperty(sayHelloPI3);


        // Create envelope
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11);
        //Set envelope as dotNet
        envelope.dotNet = true;
        // Set output SOAP object
        envelope.setOutputSoapObject(request);


        // Create HTTP call object
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

        try {
            // Invoke web service
            androidHttpTransport.call(SOAP_ACTION+webMethName, envelope);
            // Get the response
            SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
            // Assign it to resTxt variable static variable
            resTxt = response.toString();

        } catch (Exception e) {
            //Print error
            e.printStackTrace();
            //Assign error message to resTxt
            resTxt = "Error occured";
        }
        //Return resTxt to calling object
        return resTxt;
    }
}

While I am debugging the code , I have an error as mentioned on the question title. The error is seen on the

 // Get the response
        SoapPrimitive response = (SoapPrimitive) envelope.getResponse();

I think I can't get response from webservice. How Can I fix it ?

Webservice returns xml.InnerText. It's type String.

Please answer me.

I am trying to check whilist registrating. When an enterd email exists and then try to register it untill the registration is successfull but I don't want that.

protected void btnRegister_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {

            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
            con.Open();
            SqlCommand  cmd = new SqlCommand ("Select count(*) from tblUsers where Email = '" + txtEmail.Text + "' ", con);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet  ds = new DataSet();
            da.Fill(ds);


            if (ds.Tables[0].Rows.Count > 0)
            {
                p.UserName = txtUsername.Text;
                p.Email = txtEmail.Text;
                p.DOB = Convert.ToDateTime(txtDob.Text);
                p.Password = txtPass.Text;
                p.InsertUser(p);
                Response.Write("Registration Successfull..");
            }
            else {
                Response.Write("This Email is Already Exist...!!");
            }
        }
        else
        {
            Response.Write("Fail...");
        }
    }

I am using kendo grid in my ASP.NET applicatoin and have a custom command in the grid which looks like this

Columns.Command(command => { command.Custom("Details").Text("<span class='k-icon k-edit'></span>").Click("ProductDetailView");

which shows a button with only a pencil icon on it.

I am using Pjax and for that cause ProductDetailView looks like this:

    function ProductDetailView(e)
    {
        var dataItem = this.dataItem($(e.target).closest("tr"));
        var PK = dataItem.PKProduct;
        e.target.href = "Product/Details/" + PK;
    }

When I click the button on its white space, href will be applied and every thing's fine. But the problem is that when I click the button exactly on the pencil icon, it does nothing (adds "#" to URL).

If I use text instead of icon it works fine. but I'm stuck with icon.

Any ideas why is that?

I'm attempting to use the DotNet HighChart Library in an ASP.Net 5 / MVC 6 project to add charts to a page.

I've imported the library from NuGet and added the scipt references on the _layout view:

<script type="text/javascript" src="~/lib/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="~/lib/highcharts/highcharts.js"></script>

I've defined a ViewModel class to hold the Chart:

public class IndexReportViewModel
{
    public Highcharts Chart { get; set; }
}

and created it and filled it with the stock example in the controller:

    public IActionResult Index()
    {
        IndexReportViewModel ivm = new IndexReportViewModel();

        Highcharts chart = new Highcharts("chart")
            .SetXAxis(new XAxis
            {
                Categories = new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
            })
            .SetSeries(new Series
            {
                Data = new Data(new object[] { 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4 })
            });

        ivm.Chart = chart;
        return View(ivm);
    }

The Controller has the required namespaces:

using DotNet.Highcharts;
using DotNet.Highcharts.Options;
using DotNet.Highcharts.Helpers;

Finally I've referenced it in the Index View:

@model TimeCheckBES.ViewModels.Reports.IndexReportViewModel

<p>My Chart</p>
   @Model.Chart

When the page loads it just seems to display the type of the HighCharts object, e.g.:

HighCharts Fail

Any ideas? I've tried:

  • Adding the js references to the view itself rather than the _layout (I've checked the page in dev mode and they are loading).
  • Calling the @Model.Chart.ToHtmlString() in the Index view.
  • Not using a ViewModel and directly returning the chart object.

I think I must be missing something about the way js scripts work but can't think what it might be.

EDIT: Additional info

I've also added the namespaces directly to the view, although the compiler doesn't think they're necessary.

@using DotNet.Highcharts;
@using DotNet.Highcharts.Options;
@using DotNet.Highcharts.Helpers;

I am making a dashboard with charts and gridview but on pageload it takes such a long time to get data from oracle cloud service. So instead I want to use ajax so that page loads and data grids one by one populates.

how can I do it? please help

I am not sure if this is possible but wanted to confirm. I have created a website in ASP.net where an admin uploads all the videos, The videos are displayed on the front end to the customers, my client wants to rearrange these videos where the customers can simple drag and rearrange it.

This is like a page where you can see 10 or 20 videos just like you tube, i know you can drag the images but is dragging possible for the actual videos, please let me know.

If i can place the videos in a div, can the divs be dragged and rearranged?

Thanks VJ

I have listview and onPage load all data gets displayed in it. To filter listview I have 4 types of RedioButtonList (area, service, facility, payment). Now suppose I apply first filter i.e. area then it works fine but after that I apply service Filter than area goes blank. It should find selected service on selected area. After debugging I seen what query actually passes is as below

select * from table where areaName = '' and services = 'selected service'

but it should be go like this

select * from table where areaName = 'SelectedArea' and services = 'selected service'

Following function I am running On each filter IndexChanged

Private Sub getResult()
    Try
        Dim citySelector As DropDownList = Page.Master.FindControl("locationSelector")
        Dim where As String = String.Empty
        Session("Data") = Nothing
        If areasList.SelectedValue <> "All" Then
            where = "address like '%" & areasList.SelectedValue & "%'"
        End If

        If servicesList.SelectedValue <> "All" Then
            If String.IsNullOrEmpty(where) Then
                where = "serviceID like '%" & servicesList.SelectedValue.ToString & "%'"
            Else
                where &= "and serviceID like '" & servicesList.SelectedValue.ToString & "%'"
            End If
        End If

        If facilitiesList.SelectedValue <> "All" Then
            If String.IsNullOrEmpty(where) Then
                where = "facilities like '%" & facilitiesList.SelectedValue & "%'"
            Else
                where &= "and facilities like '" & facilitiesList.SelectedValue & "%'"
            End If
        End If

        If paymentsList.SelectedValue <> "All" Then
            If String.IsNullOrEmpty(where) Then
                where = "payment like '%" & paymentsList.SelectedValue.ToString & "%'"
            Else
                where &= "and payment like '%" & paymentsList.SelectedValue.ToString & "%'"
            End If
        End If

        Dim query As String = "SELECT hospitalID, name, address, thumbnail, knownFor, mondayFrom, mondayTo, consultancyFees FROM hospitals where city = '" + citySelector.SelectedItem.ToString + "' and status = 'active'"
        If Not String.IsNullOrEmpty(where) Then
            query &= " and " & where
        End If

        Dim cmd As New MySqlCommand(query, con)
        Dim da As New MySqlDataAdapter(cmd)
        Dim table As New DataTable
        da.Fill(table)
        Session("Data") = table
        hospitals.DataSource = table
        hospitals.DataBind()
    Catch ex As Exception
        Response.Write(ex)
    End Try
End Sub

Where I am doing wrong please help.

I am using asp.net C#.I have created one content page.I don't want user to go back using browser back button.I came to know that it can be done using javascript.Below is my code.

<script>
function preventBack(){window.history.forward();}
setTimeout("preventBack()", 0);
window.onunload=function(){null};
</script>

But I am using content page not normal webpage.My page don't have body tag.I want to disable back button only for this page not entire web site.How to do that?

Hello i'm trying to make an asp web application that send SMS to registered users whenever they receive an email , I'm a beginner when it comes to codding so I can't think of a pratique way to make it do that , I thought of adding a timer and making it check every 5 minutes in the sql database for every user if there was something new but this will make the application slow assuming we have hundred of users , I also thought of adding a trigger in the database and having it do the work but I can't find how to use an sql trigger in visual studio , any Ideas that could help me ? Thank you .

i done the chat application using signalrclient and chatsever implemented as class.Now i want to implented chat server as wcf service.

    <link rel="stylesheet" href="Styles/jquery-ui.css" />
    <script src="Scripts/jquery-1.8.2.js"></script>
    <script src="Scripts/jquery-ui.js"></script>
    <script type="text/javascript" src="Scripts/jquery.dialogextend.1_0_1.js"></script>
    <script type="text/javascript" src="Scripts/jquery.signalR.js"></script>
    <script type="text/javascript" src="Scripts/jQuery.tmpl.js"></script>
    <script type="text/javascript" src="signalr/hubs"></script>
    <script id="new-online-contacts" type="text/x-jquery-tmpl">
        <div>
        <ul>
        {{each messageRecipients}}
            <li id="chatLink${messageRecipientId}"><a href="javascript:;" onclick="javascript:SRChat.initiateChat('${messageRecipientId}','${messageRecipientName}');">${messageRecipientName}</a></li>
        {{/each}}
        </ul>
        </div>
    </script>
    <script id="new-chatroom-template" type="text/x-jquery-tmpl">
    <div id="chatRoom${chatRoomId}" class="chatRoom">
        <ul id="messages${chatRoomId}" class="chatMessages">
        </ul>
        <form id="sendmessage${chatRoomId}" action="#">
            <input type="text" id="newmessage${chatRoomId}" class="chatNewMessage"/>
            <div class="clear"></div>
            <input type="button" id="chatsend${chatRoomId}" value="Send" class="chatSend" OnClick="javascript:SRChat.sendChatMessage('${chatRoomId}')" />
            <input type="button" id="chatend${chatRoomId}" value="End Chat" class="chatSend" OnClick="javascript:SRChat.endChat('${chatRoomId}')" />
        </form>
    </div>
    </script>
    <script id="new-chat-header" type="text/x-jquery-tmpl">
    <div id="chatRoomHeader${chatRoomId}">
        {{each messageRecipients}}
            {{if $index == 0}}
                ${messageRecipientName}
            {{else}}
                , ${messageRecipientName}
            {{/if}}
        {{/each}}
    <div>
    </script>
    <script id="new-message-template" type="text/x-jquery-tmpl">
    <li class="message" id="m-${chatMessageId}">
        <strong>${displayPrefix}</strong>
        {{html messageText}}
    </li>
    </script>
    <script id="new-notify-message-template" type="text/x-jquery-tmpl">
    <li class="message" id="m-${chatMessageId}">
        <strong>{{html messageText}}</strong>
    </li>
    </script>
    <script type="text/javascript"> 
    //<![CDATA[

        $(document).ready(function () {

            SRChat.attachEvents();
        });

        SRChat = new function () {
          var  Username = GetParameterValues('Username');
            function GetParameterValues(param) {
                var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
                for (var i = 0; i < url.length; i++) {
                    var urlparam = url[i].split('=');
                    if (urlparam[0] == param) {
                        return urlparam[1];
                    }
                }
            }
            var chatRooms = 0;
            var numRand = Username;
            var senderId = numRand;
            var senderName = 'User :' + numRand;

            var sRChatServer;

            window.onbeforeunload = function () {
                if (chatRooms > 0)
                    return "All chat instances will be ended!";
            };

            this.attachEvents = function () {
                $("#userNameLabel").html(senderName);
                if ($.connection != null) {
                    jQuery.support.cors = true;
                    $.connection.hub.url = 'signalr/hubs';
                    sRChatServer = $.connection.sRChatServer;

                    $.connection.hub.start({ transport: 'auto' }, function () {
                        sRChatServer.server.connect(senderId, senderName).fail(function (e) {
                            alert(e);
                        });
                    });

                    sRChatServer.client.initiateChatUI = function (chatRoom) {
                        var chatRoomDiv = $('#chatRoom' + chatRoom.chatRoomId);
                        if (($(chatRoomDiv).length > 0)) {
                            var chatRoomText = $('#newmessage' + chatRoom.chatRoomId);
                            var chatRoomSend = $('#chatsend' + chatRoom.chatRoomId);
                            var chatRoomEndChat = $('#chatend' + chatRoom.chatRoomId);

                            chatRoomText.show();
                            chatRoomSend.show();
                            chatRoomEndChat.show();
                        }
                        else {
                            var e = $('#new-chatroom-template').tmpl(chatRoom);
                            var c = $('#new-chat-header').tmpl(chatRoom);

                            chatRooms++;

                            //dialog options
                            var dialogOptions = {
                                "id": '#messages' + chatRoom.chatRoomId,
                                "title": c,
                                "width": 360,
                                "height": 365,
                                "modal": false,
                                "resizable": false,
                                "close": function () { javascript: SRChat.endChat('' + chatRoom.chatRoomId + ''); $(this).remove(); }
                            };

                            // dialog-extend options
                            var dialogExtendOptions = {
                                "close": true,
                                "maximize": false,
                                "minimize": true,
                                "dblclick": 'minimize',
                                "titlebar": 'transparent'
                            };

                            e.dialog(dialogOptions).dialogExtend(dialogExtendOptions);

                            $('#sendmessage' + chatRoom.chatRoomId).keypress(function (e) {
                                if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
                                    $('#chatsend' + chatRoom.chatRoomId).click();
                                    return false;
                                }
                            });
                        }
                    };

                    sRChatServer.client.updateChatUI = function (chatRoom) {
                        var chatRoomHeader = $('#chatRoomHeader' + chatRoom.chatRoomId);
                        var c = $('#new-chat-header').tmpl(chatRoom);
                        chatRoomHeader.html(c);
                    };

                    sRChatServer.client.receiveChatMessage = function (chatMessage, chatRoom) {
                        sRChatServer.client.initiateChatUI(chatRoom);
                        var chatRoom = $('#chatRoom' + chatMessage.conversationId);
                        var chatRoomMessages = $('#messages' + chatMessage.conversationId);
                        var e = $('#new-message-template').tmpl(chatMessage).appendTo(chatRoomMessages);
                        e[0].scrollIntoView();
                        chatRoom.scrollIntoView();
                    };

                    sRChatServer.client.receiveLeftChatMessage = function (chatMessage) {
                        var chatRoom = $('#chatRoom' + chatMessage.conversationId);
                        var chatRoomMessages = $('#messages' + chatMessage.conversationId);
                        var e = $('#new-notify-message-template').tmpl(chatMessage).appendTo(chatRoomMessages);
                        e[0].scrollIntoView();
                        chatRoom.scrollIntoView();
                    };

                    sRChatServer.client.receiveEndChatMessage = function (chatMessage) {
                        var chatRoom = $('#chatRoom' + chatMessage.conversationId);
                        var chatRoomMessages = $('#messages' + chatMessage.conversationId);
                        var chatRoomText = $('#newmessage' + chatMessage.conversationId);
                        var chatRoomSend = $('#chatsend' + chatMessage.conversationId);
                        var chatRoomEndChat = $('#chatend' + chatMessage.conversationId);

                        chatRooms--;

                        var e = $('#new-notify-message-template').tmpl(chatMessage).appendTo(chatRoomMessages);

                        chatRoomText.hide();
                        chatRoomSend.hide();
                        chatRoomEndChat.hide();

                        e[0].scrollIntoView();
                        chatRoom.scrollIntoView();
                    };

                    sRChatServer.client.onGetOnlineContacts = function (chatUsers) {
                        var e = $('#new-online-contacts').tmpl(chatUsers);
                        var chatLink = $('#chatLink' + senderId);
                        e.find("#chatLink" + senderId).remove();
                        $("#chatOnlineContacts").html("");
                        $("#chatOnlineContacts").html(e);
                    };
                }
            };

            this.sendChatMessage = function (chatRoomId) {
                var chatRoomNewMessage = $('#newmessage' + chatRoomId);

                if (chatRoomNewMessage.val() == null || chatRoomNewMessage.val() == "")
                    return;

                var chatMessage = {
                    senderId: senderId,
                    senderName: senderName,
                    conversationId: chatRoomId,
                    messageText: chatRoomNewMessage.val()
                };

                chatRoomNewMessage.val('');
                chatRoomNewMessage.focus();
                sRChatServer.server.sendChatMessage(chatMessage).fail(function (e) {
                    alert(e);
                });

                return false;
            };

            this.endChat = function (chatRoomId) {
                var chatRoomNewMessage = $('#newmessage' + chatRoomId);

                var chatMessage = {
                    senderId: senderId,
                    senderName: senderName,
                    conversationId: chatRoomId,
                    messageText: chatRoomNewMessage.val()
                };
                chatRoomNewMessage.val('');
                chatRoomNewMessage.focus();
                sRChatServer.server.endChat(chatMessage).fail(function (e) {
                    //alert(e);
                });
            };

            this.initiateChat = function (toUserId, toUserName) {
                if (sRChatServer == null) {
                    alert("Problem in connecting to Chat Server. Please Contact Administrator!");
                    return;
                }
                sRChatServer.server.initiateChat(senderId, senderName, toUserId, toUserName).fail(function (e) {
                    alert(e);
                });
            };

        };
    //]]> 
    </script>
</head>
<body>
    <form id="form1" runat="server">

    <div>

        <div id="userNameLabel">
        </div>
        <br />
        <br />
        <div id="chatRooms">
        </div>
        <div id="chatOnlineContacts">
        </div>
    </div>
    </form>
</body>

My server side code is

using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Threading.Tasks;
using SignalR.Hubs;

namespace SRChat
{
    [HubName("sRChatServer")]
    public class SRChatServer:Hub

    {
        #region Private Variables
        private static readonly ConcurrentDictionary<string, MessageRecipient> _chatUsers = new ConcurrentDictionary<string, MessageRecipient>(StringComparer.OrdinalIgnoreCase);
        private static readonly ConcurrentDictionary<string, ChatRoom> _chatRooms = new ConcurrentDictionary<string, ChatRoom>(StringComparer.OrdinalIgnoreCase);
        #endregion

        #region Public Methods

        public bool Connect(string userId, string userName)
        {
            try
            {
                if (string.IsNullOrEmpty(userId) | string.IsNullOrEmpty(userName))
                {
                    return false;
                }
                if (GetChatUserByUserId(userId) == null)
                {
                    AddUser(userId, userName);
                }
                else
                {
                    ModifyUser(userId, userName);
                }
                SendOnlineContacts();
                return true;
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Problem in connecting to chat server!");
            }
        }
        public override Task Disconnect()
        {
            try
            {
                DeleteUser(Context.ConnectionId);
                return null;
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Problem in disconnecting from chat server!");
            }
        }
        public bool InitiateChat(string fromUserId, string fromUserName, string toUserId, string toUserName)
        {
            try
            {
                if (string.IsNullOrEmpty(fromUserId) || string.IsNullOrEmpty(fromUserName) || string.IsNullOrEmpty(toUserId) || string.IsNullOrEmpty(toUserName))
                {
                    return false;
                }

                var fromUser = GetChatUserByUserId(fromUserId);
                var toUser = GetChatUserByUserId(toUserId);

                if (fromUser != null && toUser != null)
                {
                    if (!CheckIfRoomExists(fromUser, toUser))
                    {
                        //Create New Chat Room
                        ChatRoom chatRoom = new ChatRoom();
                        chatRoom.chatRoomInitiatedBy = fromUser.messageRecipientId;
                        chatRoom.chatRoomInitiatedTo = toUser.messageRecipientId;

                        chatRoom.messageRecipients.Add(fromUser);
                        chatRoom.messageRecipients.Add(toUser);

                        //create and save blank message to get new conversation id
                        ChatMessage chatMessage = new ChatMessage();
                        chatMessage.messageText = "Chat Initiated";
                        chatMessage.senderId = fromUser.messageRecipientId;
                        chatMessage.senderName = fromUser.messageRecipientName;

                        fromUser.chatRoomIds.Add(chatRoom.chatRoomId);
                        toUser.chatRoomIds.Add(chatRoom.chatRoomId);

                        //Create SignalR Group for this chat room and add users connection to it
                        Groups.Add(fromUser.connectionId, chatRoom.chatRoomId);
                        Groups.Add(toUser.connectionId, chatRoom.chatRoomId);

                        //Add Chat room object to collection
                        if (_chatRooms.TryAdd(chatRoom.chatRoomId, chatRoom))
                        {
                            //Generate Client UI for this room
                            Clients[fromUser.connectionId].initiateChatUI(chatRoom);
                        }
                    }
                }
                return true;
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Problem in starting chat!");
            }
        }
        public bool EndChat(ChatMessage chatMessage)
        {
            try
            {
                ChatRoom chatRoom;
                if (_chatRooms.TryGetValue(chatMessage.conversationId, out chatRoom))
                {
                    if (_chatRooms[chatRoom.chatRoomId].chatRoomInitiatedBy == chatMessage.senderId)
                    {
                        chatMessage.messageText = string.Format("{0} left the chat. Chat Ended!", chatMessage.senderName);
                        if (_chatRooms.TryRemove(chatRoom.chatRoomId, out chatRoom))
                        {
                            Clients[chatRoom.chatRoomId].receiveEndChatMessage(chatMessage);
                            foreach (MessageRecipient messageReceipient in chatRoom.messageRecipients)
                            {
                                if (messageReceipient.chatRoomIds.Contains(chatRoom.chatRoomId))
                                {
                                    messageReceipient.chatRoomIds.Remove(chatRoom.chatRoomId);
                                    Groups.Remove(messageReceipient.connectionId, chatRoom.chatRoomId);
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageRecipient messageRecipient = GetChatUserByUserId(chatMessage.senderId);
                        if (messageRecipient != null && messageRecipient.chatRoomIds.Contains(chatRoom.chatRoomId))
                        {
                            chatRoom.messageRecipients.Remove(messageRecipient);
                            messageRecipient.chatRoomIds.Remove(chatRoom.chatRoomId);
                            if (chatRoom.messageRecipients.Count < 2)
                            {
                                chatMessage.messageText = string.Format("{0} left the chat. Chat Ended!", chatMessage.senderName);
                                if (_chatRooms.TryRemove(chatRoom.chatRoomId, out chatRoom))
                                {
                                    Clients[chatRoom.chatRoomId].receiveEndChatMessage(chatMessage);
                                    foreach (MessageRecipient messageReceipient in chatRoom.messageRecipients)
                                    {
                                        if (messageReceipient.chatRoomIds.Contains(chatRoom.chatRoomId))
                                        {
                                            messageReceipient.chatRoomIds.Remove(chatRoom.chatRoomId);
                                            Groups.Remove(messageReceipient.connectionId, chatRoom.chatRoomId);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                chatMessage.messageText = string.Format("{0} left the chat.", chatMessage.senderName);
                                Groups.Remove(messageRecipient.connectionId, chatRoom.chatRoomId);
                                Clients[messageRecipient.connectionId].receiveEndChatMessage(chatMessage);
                                Clients[chatRoom.chatRoomId].receiveLeftChatMessage(chatMessage);
                                Clients[chatRoom.chatRoomId].updateChatUI(chatRoom);
                            }
                        }
                    }
                }
                else
                {
                    throw new InvalidOperationException("Problem in ending chat!");
                }
                return true;
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Problem in ending chat!");
            }
        }
        public bool SendChatMessage(ChatMessage chatMessage)
        {
            try
            {
                ChatRoom chatRoom;
                if (_chatRooms.TryGetValue(chatMessage.conversationId, out chatRoom))
                {
                    chatMessage.chatMessageId = Guid.NewGuid().ToString();
                    chatMessage.timestamp = DateTime.Now;
                    Clients[chatMessage.conversationId].receiveChatMessage(chatMessage, chatRoom);
                    return true;
                }
                else
                {
                    throw new InvalidOperationException("Problem in sending message!");
                }
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Problem in sending message!");
            }
        }
        private bool SendOnlineContacts()
        {
            try
            {
                OnlineContacts onlineContacts = new OnlineContacts();
                foreach (var item in _chatUsers)
                {
                    onlineContacts.messageRecipients.Add(item.Value);
                }
                Clients.onGetOnlineContacts(onlineContacts);
                return false;
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Problem in getting contacts!");
            }
        }

        #endregion

        #region Private Methods

        private Boolean CheckIfRoomExists(MessageRecipient fromUser, MessageRecipient toUser)
        {
            foreach (string chatRoomId in fromUser.chatRoomIds)
            {
                Int32 count = (from mr in _chatRooms[chatRoomId].messageRecipients
                               where mr.messageRecipientId == toUser.messageRecipientId
                               select mr).Count();
                if (count > 0)
                {
                    return true;
                }
            }
            foreach (string chatRoomId in toUser.chatRoomIds)
            {
                Int32 count = (from mr in _chatRooms[chatRoomId].messageRecipients
                               where mr.messageRecipientId == fromUser.messageRecipientId
                               select mr).Count();
                if (count > 0)
                {
                    return true;
                }
            }
            return false;
        }
        private MessageRecipient AddUser(string userId, string userName)
        {
            var user = new MessageRecipient();
            user.messageRecipientId = userId;
            user.messageRecipientName = userName;
            user.connectionId = Context.ConnectionId;
            _chatUsers[userId] = user;
            return user;
        }
        private MessageRecipient ModifyUser(string userId, string userName)
        {
            var user = GetChatUserByUserId(userId);
            user.messageRecipientName = userName;
            user.connectionId = Context.ConnectionId;
            _chatUsers[userId] = user;
            return user;
        }
        private Boolean DeleteUser(string userId, string userName)
        {
            var user = GetChatUserByUserId(userId);
            if (user != null && _chatUsers.ContainsKey(user.messageRecipientId))
            {
                MessageRecipient messageRecipient;
                return _chatUsers.TryRemove(user.messageRecipientId, out messageRecipient);
            }
            return false;
        }
        private Boolean DeleteUser(string connectionId)
        {
            var returnValue = false;
            var user = GetChatUserByConnectionId(connectionId);
            if (user != null && _chatUsers.ContainsKey(user.messageRecipientId))
            {
                MessageRecipient messageRecipient;
                returnValue = _chatUsers.TryRemove(user.messageRecipientId, out messageRecipient);

                //remoave from all groups and chatrooms
                foreach (string chatRoomId in messageRecipient.chatRoomIds)
                {
                    _chatRooms[chatRoomId].messageRecipients.Remove(messageRecipient);

                    Groups.Remove(messageRecipient.connectionId, chatRoomId);

                    //notify user left chat
                    ChatMessage chatMessage = new ChatMessage();
                    chatMessage.conversationId = chatRoomId;
                    chatMessage.senderId = messageRecipient.messageRecipientId;
                    chatMessage.senderName = messageRecipient.messageRecipientName;
                    if (_chatRooms[chatRoomId].chatRoomInitiatedBy == messageRecipient.messageRecipientId)
                    {
                        chatMessage.messageText = string.Format("{0} left the chat. Chat Ended!", messageRecipient.messageRecipientName);
                        ChatRoom chatRoom;

                        if (_chatRooms.TryRemove(chatRoomId, out chatRoom))
                        {
                            foreach (MessageRecipient messageReceipient in chatRoom.messageRecipients)
                            {
                                if (messageReceipient.chatRoomIds.Contains(chatRoomId))
                                {
                                    messageReceipient.chatRoomIds.Remove(chatRoomId);
                                }
                            }
                            Clients[chatRoomId].receiveEndChatMessage(chatMessage);
                        }
                    }
                    else
                    {
                        if (_chatRooms[chatRoomId].messageRecipients.Count() < 2)
                        {
                            chatMessage.messageText = string.Format("{0} left the chat. Chat Ended!", messageRecipient.messageRecipientName);
                            ChatRoom chatRoom;
                            if (_chatRooms.TryRemove(chatRoomId, out chatRoom))
                            {
                                foreach (MessageRecipient messageReceipient in chatRoom.messageRecipients)
                                {
                                    if (messageReceipient.chatRoomIds.Contains(chatRoomId))
                                    {
                                        messageReceipient.chatRoomIds.Remove(chatRoomId);
                                    }
                                }
                                Clients[chatRoomId].receiveEndChatMessage(chatMessage);
                            }
                        }
                        else
                        {
                            chatMessage.messageText = string.Format("{0} left the chat.", messageRecipient.messageRecipientName);
                            Clients[chatRoomId].receiveLeftChatMessage(chatMessage);
                        }
                    }
                }
            }
            return returnValue;
        }
        private MessageRecipient GetChatUserByUserId(string userId)
        {
            return _chatUsers.Values.FirstOrDefault(u => u.messageRecipientId == userId);
        }
        private MessageRecipient GetChatUserByConnectionId(string connectionId)
        {
            return _chatUsers.Values.FirstOrDefault(u => u.connectionId == connectionId);
        }

        #endregion
    }
}

i want to implement this one as wcf service or web service. please help me in advance

this is my code

protected void btnUpload_Click(object sender, EventArgs e)
{
    try
    {
        string filename = Path.GetFileName(FileUpload1.FileName);
        FileUpload1.SaveAs(Server.MapPath("~/CustomerFiles/") + filename);
        lblResult.Text = "Your File " + filename + " is Succesfull uploaded!";
        //lblFile.Text = FileUpload1.FileName;
        lblFile.Text = "../CustomerFiles/" + filename;
        Page_Load(sender, e);
    }

    catch (Exception)

    {
        lblResult.Text = "Upload Failed";
    }
}

I can Upload files but I can't see it in my visual studio 2013.I need to see my uploaded files in order for me to download it and save its filepath to Sql Database.

sir please help me out from this problem.i have already try many solution but i did not get exact solution for dis problem..please give me source code for online examination on my mail id mansimcatyagi72@gmail.com. till now i do data connectivity

  SqlConnection con = new SqlConnection("server=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database1.mdf;Integrated Security=True;User Instance=True;trusted_connection=yes");
    public class x
    {
        int a;


        protected void Page_Load(object sender, EventArgs e)
        {

            SqlCommand cmd = new SqlCommand("select Qname,op1,op2,op3,op4 from userdata where qid = '" + a + "')", con);
        }
    }

thank you sir.

I have a aspx page with a asp:gridview, whose columns have a click button. On click a pdf file has to open, i have managed to open the pdf in the same tab. But what i need is to open the pdf in a new tab so that the user can get back to the website and continue where he has left.

<asp:GridView runat="server" ID="loyaltyprog" Visible="true" AutoGenerateColumns="false" CssClass="accounTbl" OnRowCommand="loyaltyprog_RowCommand">
        <HeaderStyle />
        <Columns>
            <asp:BoundField DataField="S.No." HeaderText="S.No."
                                        ItemStyle-HorizontalAlign="Left" />
                                    <asp:BoundField DataField="ProgramName" HeaderText="Program Name" HeaderStyle-Width="50%"
                                        ItemStyle-HorizontalAlign="left" />
                                    <asp:BoundField DataField="ProgramCode" HeaderText="Program Code" HeaderStyle-Width="50%"
                                        ItemStyle-HorizontalAlign="Right" Visible="false" />
                                    <asp:BoundField DataField="FromDate" HeaderText="From Date"
                                        ItemStyle-HorizontalAlign="center" />
                                    <asp:BoundField DataField="ToDate" HeaderText="To Date"
                                        ItemStyle-HorizontalAlign="center" />
                                    <asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderText="Program T&C">
                                        <ItemTemplate>
                                    <asp:LinkButton ID="LinkButtonTC" runat="server"  Text="Click" CommandName="select" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" ></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                   <%-- <asp:TemplateField ItemStyle-HorizontalAlign="Left" Visible="false">
                                        <ItemTemplate>
                                    <asp:Label ID="LabelEnrolled" runat="server" Enabled="false" ></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>--%>


        </Columns>
    </asp:GridView>

in the row_command event of the grid i am doing this

DataTable dt = new DataTable();
        dt = (DataTable)ViewState["LoyaltiyPrograms"];
        if (dt != null)
        {
            if (e.CommandName == "select")
            {
                // Retrieve the row index stored in the 
                // CommandArgument property.
                int index = Convert.ToInt32(e.CommandArgument);

                // Retrieve the row that contains the button 
                // from the Rows collection.
                GridViewRow row = loyaltyprog.Rows[index];



                string pathTC = dt.Rows[index]["DocumentPath"].ToString();


                string pdfPath = Server.MapPath(pathTC);
                WebClient client = new WebClient();

                Byte[] buffer = client.DownloadData(pdfPath);
                Response.ContentType = "application/pdf";
                Response.AddHeader("content-length", buffer.Length.ToString());

                Response.BinaryWrite(buffer);
                Response.End();

Is there something in the rowcommand event that i need to change to get the pdf in a new tab?

I have a Class library and within that I must adding multiple Web References, depends on current customer. in this layer I want to have a method, calling Send and withing that I want to implement current Web References, depends on current customer. (for ex. customer A has Web References A, customer B has Web References B, and so on)

Web References are third party

I have a 'Web app' and in that I call that Send method.

All I need is writing Send method in some way that I don't need to change anything in Web app layer when I adding new Web References. (just changing Send method be enough)

I using ASP.NET Web forms & C#.

I didn't have any idea about the title of question, sorry about that.

Ex.

How I must implement, Web References A:

public string Send(string[] mobiles, string[] messages)
{
    // Calling Web References A Send method
}

How I must implement Web References B:

public string Send(string mobiles, string messages)
{
    // Calling Web References B Send method
}

But in Web app layer I need to call just Send and and pass 2 string, mobile & message and don't care Send method calling which Web References.

Update

public string Send_1(string mobiles, string messages)
{
    // Calling Web References B Send method
}

public string Send_2(string mobiles, string messages)
{
    // Calling Web References B Send method
}

...

public string Send(string mobiles, string messages)
{
    // Here how to detect which one, Send_1 or Send_2 must be called?
}

In Web layer

Send("Mobile", "Message");

I think something like Dependency injection in MVC is need for my case.