Questions




Answers
1
How to append jQuery bootstrap calender on dynamically created element in ASP.NET MVC?

Here, I am appending Model data to <td> from the model List and trying to do inplace (inline) editing and I want to validate the form using for loop.

Now, I would like to add/append the calender to start date and end date (dynamic textbox elements)using bootstrap calendar. How can I do it?

here is my Current C# razor view code:

<tbody>
@if (List.Count > 0)
{
for (int i = 0; i < List.Count; i++)
{
<tr id="Tr_@i.ToString()">
<td>
<input type="hidden" value="@List[i].ID" id="hdnId_@i.ToString()" />
<input type="text" class="form-control" id="txtName_@i.ToString()" value="@List[i].Name" />
</td>

<td class="hideCol2 hideHideCol_2">
<input type="text" class="form-control" id="txtDescription_@i.ToString()" value="@List[i].Description" />
</td>

<td class="hideCol3 hideHideCol_3">
<input type="text" class="form-control" id="txtTopCount@i.ToString()" value="@List[i].TopCount" />
</td>

<td class="hideCol4 hideHideCol_4">
<div class="input-group date" id="editstartDate">
<input type="text" class="form-control" id="txtStart_Date_@i.ToString()" value="@List[i].Start_Date.ToString("dd/MM/yyyy")" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</td>

<td class="hideCol5 hideHideCol_5">
<div class="input-group date editendDate" data-provide="datepicker">
<input type="text" class="form-control" id="txtEnd_Date_@i.ToString()" value="@List[i].End_Date.ToString("dd/MM/yyyy")" />
<span class="input-group-addon">
<i class="glyphicon glyphicon-th"></i>

</span>
</div>
</td>


</tr>
}
}
else
{
<tr></tr>
}
</tbody>

Here is the screenshot of my view

...

Read More
ASP.NET MVC jQuery
Answers
3
chart.js bind with list of object from controller

Hi, I'm trying to use list of object returned by Json to bind chart.js but I don't know how can I get the first element of object and second element of object and show it in chart.js.

My code is as below :

Class

...
Read More
chart.js list of object mvc
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
ASP.NET ArgumentNullException
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
SQL count the occurrence of specific word
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
chart.js database javascript
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
MVC Oauth facebook asp.net
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
MVC visual-studio-2017
Answers
1
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
HTML open link in new tab html
Answers
2
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
MVC C# partial view
Answers
2
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
ASP.NET http https

Page 1 of 34