Questions




Answers
2
An exception of type 'System.ArgumentNullException' occurred in System.Data.dll was not handled in user code Additional information: The 'dataType' argument can not be null.

Hi, I am getting an exeption

An exception of type 'System.ArgumentNullException' occurred in System.Data.dll was not handled in user code Additional information: The 'dataType' argument can not be null.

When executing the below code

[HttpPost]
public JsonResult Chart()
{
string constr = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("select text,date from T"))
{
cmd.Connection = con;
con.Open();
SqlDataReader sdr = cmd.ExecuteReader();
sdr.Read();
//Create a new DataTable.
DataTable dt = new DataTable("T");
List<object> iData = new List<object>();
//Load DataReader into the DataTable.
// dt.Load(sdr);
dt.Columns.Add(sdr["text"].ToString(), System.Type.GetType("System.String"));
dt.Columns.Add(sdr["date"].ToString(), System.Type.GetType("System.Datetime"));

foreach (DataColumn dc in dt.Columns)
{
List<object> x = new List<object>();
x = (from DataRow drr in dt.Rows select drr[dc.ColumnName]).ToList();
iData.Add(x);

}
//Source data returned as JSON
return Json(iData, JsonRequestBehavior.AllowGet);

}
}

}

Here is the image of the error

...

Read More
Answers
2
How to count the occurrence of specific word inside a string in sql server 2008?

Hi. Suppose, I have for example this string field in my sql database  "never say never"  and I want to count how many times "never" appear in the string in sql server 2008, so how I can check that.

Thanks.

...
Read More
Answers
1
How I connect chart.js to database in ASP.NET web form mvc in visual studio 2015 ?

 I have make a chart.js in my website to display chart showing demand of a fruit over date range using this script below :

 

<div class="chart-wrapper" style="height:200px;margin-top:40px;">
    <canvas id="main-chart" class="chart" height="100"></canvas>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js">
</script>
<script>
    var ctx = document.getElementById("main-chart").getContext('2d');
    var myChart = new Chart(ctx, {
        type: 'line',
        data: {
            labels: ["M", "T", "W", "T", "F", "S", "S", "M"],
            datasets: [{
                label: 'Traffic',
                data: [0, 50, 100, 150, 200, 250, 300, 350],
                backgroundColor: [
                    'rgba(255, 99, 132, 0.2)',
                    'rgba(54, 162, 235, 0.2)',
                    'rgba(255, 206, 86, 0.2)',
                    'rgba(75, 192, 192, 0.2)',
                    'rgba(153, 102, 255, 0.2)',
                    'rgba(255, 159, 64, 0.2)'
                ],
                borderColor: [
                    'rgba(255,99,132,1)',
                    'rgba(54, 162, 235, 1)',
                    'rgba(255, 206, 86, 1)',
                    'rgba(75, 192, 192, 1)',
                    'rgba(153, 102, 255, 1)',
                    'rgba(255, 159, 64, 1)'
                ],
                borderWidth: 1
            }]
        },
        options: {
            scales: {
                yAxes: [{
                    ticks: {
                        beginAtZero: true
                    }
                }]
            }
        }
    });
</script>

...

Read More
Answers
2
OAuth login error "Warning URL blocked: This redirect failed because the redirect URI is not white-listed in the app's client OAuth settings"

Hi. When trying to login using Facebook in ASP.NET MVC application, I am getting this error as shown below

Warning URL blocked: This redirect failed because the redirect URI is not white-listed in the app's client OAuth settings. Make sure that the client and web OAuth logins are on and add all your app domains as valid OAuth redirect URIs.

how I can resolve this problem? Here is the screenshot of my faceboook authorization settings.

...

Read More
Answers
2
Add MVC4 in visual studio 2017 professional

Hi, Please how we can add MVC4 to visual studio 2017 professional and can give an example site to download and install it in VS 2017 professional.

Thanks.

...
Read More
Answers
3
How to open link (a href) in new tab instead of loading url on same page?

Hello, I was working on HTML and would like to know how can I open anchor link ( HTML ) in a new tab instead of loading URL on the same page? Suppose this is my anchor tag HTML

...
Read More
Answers
3
How to call or return partial view of another controller from one controller?

When working in ASP.NET MVC, I have a partial view located inside "Views -> FirstController->_PartialView1.cshtml", I would like to call this partial view of "FirstController" from "SecondController", how can I call it in ASP.NET MVC?

The reason I am doing so is the HTML used is same, but with different data.

...
Read More
Answers
3
Error "your connection is not private" when Setting up IIS to use https

Hi, I was running https on localhost IIS for the first time, I was  usign http under my localhost and after reading this article:

https://deanhume.com/set-up-iis-7-to-run-a-secure-site-locally-https/ 

I tried to run https on my IIS and localhost.

But I'm facing this error : your connection is not private.

how can resolve that? Thanks.

 

...
Read More
Answers
1
How to deploy MVC 4 Razor ASP.NET website on somee.com?

I am trying to deploy sample website on somee.com using free hosting.

First I published my website as a folder.  

1. I created new free hosting domain on somee.com, then after logging in proceeded to file manager ->

2. Then I make a zip folder for my published website folder

3. Then I upload the zip folder and select upload and unzip archives

4. I have add the default document inside web.config like that 

<?xml version="1.0" encoding="UTF-8"?> 
    <configuration> 
        <system.webServer> 
            <defaultDocument> 
                <files> 
                    <add value="index.aspx" /> 
                </files> 
            </defaultDocument> 
        </system.webServer> 
    </configuration>

5. Now this is my root folder file structure

...

Read More
Answers
5
FB page Login Failure. Unsuccessful login with service when using OAuth in MVC

Hi, I want to login with  facebook account from my website MVC4 razor c# and add permissions for a FB user and for a FB page. I was found this article and try to do the same https://github.com/aspnet/Docs/blob/master/aspnet/mvc/overview/older-versions/using-oauth-providers-with-mvc.md

but I'm facing this error :  Login Failure. Unsuccessful login with service.

What does this error means and how can resolve that problem. Thanks.

...
Read More

Page 21 of 54