|
If it is chrome? Is there something we can do it from server side code buddy? Yeah now I am getting it - why isn't it doing it - thanks for helping me my friend.
And just saying I like this - its true
ZurdoDev wrote: Social Media - A platform that makes it easier for the crazies to find each other.
|
|
|
|
|
simpledeveloper wrote: If it is chrome? Sorry, I do not know. It's been years since I worried about this issue so I don't know what the settings look like today.
simpledeveloper wrote: Is there something we can do it from server side I believe the only thing you can do is to add the attachment header info which you already did.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
ZurdoDev wrote: I believe the only thing you can do is to add the attachment header info which you already did.
Yes I did see it - its working fine with IE, its only giving problem with Chrome - so any ideas from other users here also helpful - I will investigate a little bit about it.
|
|
|
|
|
Enclosing within the double quotes resolved the problem like in this one:
Response.AppendHeader("content-disposition", $"attachment; filename=\"{file.FileName}\"");
|
|
|
|
|
Hi...
How I can insert data into gridview without use data source???
|
|
|
|
|
|
Thank you for your answer,
But I don’t want use data source,
I want directly add the data from textbox without use DataTable
|
|
|
|
|
|
The website is working fine now I added MenuLeft.ascx into the folder "C:\WebSite2010\WebMaster\Controls\" when pressing the Rebuild website button with the error "Error: C:\WebSite2010\WebMaster\Controls\MenuTop.ascx.cs(14): error ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl)". Note that the folder "C:\WebSite2010\Controls\" already has a file with the same file name: MenuLeft.ascx now I copy the declaration of 2 files with the same name, how do I change the code ?
in the file: C:\WebSite2010\Controls\MenuLeft.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MenuLeft.ascx.cs" Inherits="MenuLeft" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register Src="~/Controls/ThuvienHinhAnh.ascx" TagPrefix="uc" TagName="ThuvienHinhAnh" %>
<%@ Register Src="~/Controls/QuangCaoLeft.ascx" TagPrefix="uc" TagName="QuangCaoLeft" %>
<%@ Register Src="~/Controls/WebURL.ascx" TagPrefix="uc" TagName="WebURL" %>
<%@ Register Src="~/Controls/Newsletter.ascx" TagPrefix="uc" TagName="Newsletter" %>
<%@ Register src="DanhMucBDS.ascx" tagname="DanhMucBDS" tagprefix="uc" %>
<%@ Register TagPrefix="webapp4U" Namespace="webapp4U.UI" %>
<table cellspacing="0" cellpadding="0" width="180" border="0">
...
</table>
in the file: C:\WebSite2010\WebMaster\Controls\MenuLeft.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MenuLeft.ascx.cs" Inherits="MenuLeft" %>
<%@ Import Namespace="webapp4U" %>
<table width="185px" border="0" cellpadding="0" cellspacing="0">
...
</table>
|
|
|
|
|
You need to first understand how code files work and then fix them. I'm not sure how to tell you to fix it because I don't know what you need or don't need. You said you have two files with the same name, so start with removing one or changing the name of one. But then make sure the codefile matches the class.
For example, in what you posted, you need to have a class in the MenuLeft.ascx.cs file that is named MenuLeft.
Just go through your files and get it cleaned up properly.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
I have fixed it, thank you for reading my post.
|
|
|
|
|
I am displaying a list of textboxes on top of an image on an ASP .NET Master/Content webpage. The image is the width of the page and has 6 even spaced white blocks. What I am trying to do is put a number in each image box white space using the CSS and HTML below. What is happening is all of the textboxes are being displayed in the same image box which is the first. In the first, the textboxes are only about 2px apart from each other and not spreading across the image 20px apart as defined it the left CSS tag. Why is my style is not correct?
Master:
<style>
.floating_label1 {
position: absolute;
z-index: 200;
top: 65px;
**left: 115px;**
}
.floating_label2 {
position: absolute;
z-index: 200;
top: 65px;
**left: 130px;**
}
.floating_label3 {
position: absolute;
z-index: 200;
top: 65px;
**left: 150px;**
}
.floating_label4 {
position: absolute;
z-index: 200;
top: 65px;
**left: 170px;**
}
.floating_label5 {
position: absolute;
z-index: 200;
top: 65px;
**left: 190px;**
}
.floating_label6 {
position: absolute;
z-index: 200;
top: 65px;
**left: 210px;**
border: hidden;
}
}
</style>
Content:
<div style="position:relative;">
<img src="Images/PAXSummary.jpg" />
<asp:TextBox ID="TextBox1" runat="server" Text="1" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label1" />
<asp:TextBox ID="TextBox2" runat="server" Text="2" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label2" />
<asp:TextBox ID="TextBox3" runat="server" Text="3" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label3" />
<asp:TextBox ID="TextBox4" runat="server" Text="4" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label4" />
<asp:TextBox ID="TextBox5" runat="server" Text="5" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label5" />
<asp:TextBox ID="TextBox6" runat="server" Text="6" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label6" />
</div>
|
|
|
|
|
The answer was simple. The only thing that needed to be done was increase the values of each TextBox's CSS left and I was able to move the controls over to the desired location. I was only increasing the px value by 20 which was way to small of a value.
|
|
|
|
|
Now in my razor view i am want to see what is stored in my raw Model ? So tell me how could i show raw model in razor view ?
or want to see what is stored in first element of Model ?
i tried this way but getting error
@model JQDataTable.Controllers.TestData
@Html.Raw(Json.Encode(@Model))
OR
@Html.Raw(Model)
Getting error now for above code.
The model item passed into the dictionary is of type
'System.Collections.Generic.List`1[JQDataTable.Controllers.UserData]',
but this dictionary requires a model item of type 'JQDataTable.Controllers.TestData'.
please rectify my code as a result i will be able to print Model in razor page. thanks
|
|
|
|
|
It would just be
@Html.Raw(Json.Encode(Model))
However I don't see how that will produce the error you're getting. It looks like you are defining the model incorrectly. Rather than
@model JQDataTable.Controllers.TestData
you might need
@model List<JQDataTable.Controllers.UserData>
|
|
|
|
|
I got Error when i use Machine key in web config file in asp.Net Project.
|
|
|
|
|
|
Searched and worked hours trying to pull off/identify when a work/project is available on a web page. Below is the source of the page and my code. I can pull the tables, which are 7, but rows comes up as nothing. Want to pull when table id="workorders" and then = Project Name/work order
Thanks
Jim
Current Work Orders
No assigned work orders found.
-------if present, want to identity/capture this
My code
Get all tables in the document
Dim k As Integer
'
' Get all tables in the document
Dim tables As HtmlAgilityPack.HtmlNodeCollection = main.DocumentNode.SelectNodes("//table").innertext
' Iterate all rows in the first table
Dim rows As HtmlAgilityPack.HtmlNodeCollection = main.DocumentNode.SelectNodes("th")
' Iterate all rows in the first table
For k = 0 To rows.Count - 1
' Iterate all columns in this row
Dim cols As HtmlAgilityPack.HtmlNodeCollection = rows(k).SelectNodes("th")
If cols IsNot Nothing Then
For j As Integer = 0 To cols.Count - 1
' Get the value of the column and print it
Dim value As String = cols(j).InnerText
Console.WriteLine(value)
Next
End If
Next
Project Name/Work Order | Date | Time | Location | Tech | Pay Rate | Pay Type | Actions | | | | | | | |
|
|
|
|
|
Member 1753250 wrote:
Dim rows As HtmlAgilityPack.HtmlNodeCollection = main.DocumentNode.SelectNodes("th") You're iterating over all <th> nodes which are direct descendants of the document. There probably aren't any.
Instead, based on the comments, you probably want to iterate over the <tr> nodes which are direct descendants of the <table> :
Dim rows As HtmlAgilityPack.HtmlNodeCollection = tables(0).SelectNodes("tr") However, this will depend on the markup. The rows might not be direct descendants of the <table> ; they could be nested in one or more <thead> , <tbody> , or <tfoot> elements.
When you query for cells, you're also only looking for <th> elements. You're skipping ordinary <td> elements.
If you don't have to worry about nested tables, you could try:
Dim rows As HtmlAgilityPack.HtmlNodeCollection = main.DocumentNode.SelectNodes("//table[@id='workorders']//tr")
For i As Integer = 0 To rows.Count - 1
Dim cols As HtmlAgilityPack.HtmlNodeCollection = rows(i).SelectNodes("th|td")
...
Next
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming, you da Man!! Got it working afer spending hours on this. Thanks SO much.
Jim
|
|
|
|
|
I am sending list of data from action to client side. in client side i am binding jquery data table with pass data. column name is extracted because column is dynamic in my case. i got a below code which is not very clear how it is working.
My question is very basic question. see how list of data is pass from action to client side.
[HttpGet]
public ActionResult Index()
{
List<UserData> data = new List<UserData>
{
new UserData
{
ID = 1,
Name = "Simon"
},
new UserData
{
ID = 2,
Name = "Alex"
}
};
return View(data);
}
passed model data is captured like below way which is not clear to me
var keys = Object.keys(@Html.Raw(Json.Encode(Model[0])));
var columns = keys.map(function (key) {
return { title: key };
});
var data = @Html.Raw(Json.Encode(Model));
var dataSet = data.map(function (d) {
return Object.values(d);
});
console.log(columns);
console.log(dataSet);
see this code first
var keys = Object.keys(@Html.Raw(Json.Encode(Model[0])));
var columns = keys.map(function (key) {
return { title: key };
});
1) we know list is kind of array then why keys are extracted from zeroth position ? Model[0] why not Model[1]
i like to know in what form data is stored into model when pass from action to client side ?
see this code again
var data = @Html.Raw(Json.Encode(Model));
var dataSet = data.map(function (d) {
return Object.values(d);
});
2) in above code no ordinal position mention during extracting data. why?
3) what is Model[0] ? how it comes? because in asp.net mvc we write model like @model not Model
4) is this Model is Asp.Net MVC related model or javascript Model object ?
During keys extraction ordinal position is mentioned but in case of data extraction no ordinal position mentioned. please explain if some one understand what i am trying to know.
My main question is i have only one question that what is Model[0] here in js? is it any JavaScript related object or server side object ? if it is javascript then how server side model data comes into js model ?
please explain how above code is working at client side. thanks
|
|
|
|
|
Both @Html.Raw(Json.Encode(Model[0])) and @Html.Raw(Json.Encode(Model)) are evaluated on the server. The Model refers to the server-side model of the view.
Not to be confused with the @model directive, which declares the type of the model for the view. @model declares the type; Model refers to the instance of that type.
@Html.Raw(Json.Encode(Model[0])) will generate a Javascript object representing the first item in the list. You specify the index because you only need the keys from one item. You don't use Model[1] in case there isn't a second item in the list.
For example, the rendered Javascript will look something like:
var keys = Object.keys({ "ID": 1, "Name": "Simon" }); NB: If the list is empty, you will get an exception when ASP.NET tries to evaluate the view to generate this code.
@Html.Raw(Json.Encode(Model)) will generate a Javascript array containing all of the items from the list. For example:
var data = [
{ "ID": 1, "Name": "Simon" },
{ "ID": 2, "Name": "Alex" }
];
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thanks a lot for your answer sir.
if i need to print at server side what is stored in Model or what is stored in first element of Model then what kind of code i need to write ?
i did it this way but getting error
[HttpGet]
public ActionResult PrintModel()
{
List<UserData> data = new List<UserData>
{
new UserData
{
ID = 1,
Name = "Simon"
},
new UserData
{
ID = 2,
Name = "Alex"
}
};
return View(data);
}
in my razor i did it this way
@Html.Raw(Json.Encode(Model))
but above code giving error....how to print raw model ?
please guide. thanks
modified 25-Dec-19 4:01am.
|
|
|
|
|
What error?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have finally gotten my code to work, but there is one thing left that I want to do.
In my code I had made a Keycard class that had a name and a keynumber.
What I would like to do is to change the Keycard class to Person Class, which keeps the Name string, and then add the Keycard class as a child to the Person class, which keeps the Mykey int.
I have done inheritance before, but I have not tried doing it in a file that also uses Serialization.
How should the code look?
Also, a small bonus question. As you can see, my code gives a binary output. Like with XML, is there a way to show this binary output on a web application?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
namespace Keycard
{
[Serializable()]
public class Keycard : ISerializable
{
protected string name;
protected int mykey;
public Keycard(string name, int mykey)
{
this.Name = name;
this.Mykey = mykey;
}
public string Name
{
get { return name; }
set { name = value; }
}
public int Mykey
{
get { return mykey; }
set { mykey = value; }
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("Name", name);
info.AddValue("Keynumber", mykey);
}
public Keycard(SerializationInfo info, StreamingContext context)
{
Name = (string)info.GetValue("Name", typeof(string));
Mykey = (int)info.GetValue("Keynumber", typeof(int));
}
public override string ToString()
{
return "Name: " + name + " ---- " + " Keynumber: " + mykey;
}
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace Keycard
{
class Class1
{
public static void Main(string[] args)
{
Keycard d1 = new Keycard("John", 102030);
Stream stream = File.Open("KeycardData.dat",
FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(stream, d1);
stream.Close();
d1 = null;
stream = File.Open("KeycardData.dat", FileMode.Open);
bf = new BinaryFormatter();
d1 = (Keycard)bf.Deserialize(stream);
stream.Close();
Console.WriteLine(d1.ToString());
Console.ReadLine();
}
}
}
|
|
|
|