Hướng dẫn object htmloptionelement to string - đối tượng htmloptionelement thành chuỗi

Tôi đang nhận được một đầu ra là đối tượng, nhưng tôi muốn bản ghi được hiển thị trong văn bản.

Hướng dẫn object htmloptionelement to string - đối tượng htmloptionelement thành chuỗi

Hướng dẫn object htmloptionelement to string - đối tượng htmloptionelement thành chuỗi

Mô phỏng

18.4K8 Huy hiệu vàng61 Huy hiệu bạc95 Huy hiệu Đồng8 gold badges61 silver badges95 bronze badges

Đã hỏi ngày 5 tháng 6 năm 2017 lúc 6:15Jun 5, 2017 at 6:15

6

Bạn có nghĩa là trong nội dung của "#BS" và "#cost" ?? Sử dụng "json.Stringify ()" Bạn biết chức năng, bạn đang sử dụng nó trong mã

Ý bạn là điều đó?

Đã trả lời ngày 5 tháng 6 năm 2017 lúc 6:26Jun 5, 2017 at 6:26

Hướng dẫn object htmloptionelement to string - đối tượng htmloptionelement thành chuỗi

1

Nếu bạn nhận được đối tượng, bạn có thể chuyển đổi nó thành chuỗi ruồi, xuất các thuộc tính của nó như thế:

$('#bs).html(result[1].id + result[1].title);

tương ứng với tên của các cột, bạn cũng có thể

console.log(result[1]) 

và kiểm tra tên thuộc tính chính xác của đối tượng

marc_s

717K172 Huy hiệu vàng1319 Huy hiệu bạc1436 Huy hiệu đồng172 gold badges1319 silver badges1436 bronze badges

Đã trả lời ngày 5 tháng 6 năm 2017 lúc 7:19Jun 5, 2017 at 7:19

Hướng dẫn object htmloptionelement to string - đối tượng htmloptionelement thành chuỗi

0

Chuyển đến nội phân

Trình Duyệt nào Không CNn Đan Hỗ trợ nữa.

Hãy nâng cấp lênn microsoft ed

Phương pháp htmlhelper.beginform

  • Tài liệu tham khảo

Sự định nghĩa

Trong bài viết này

Kết xuất một thẻ bắt đầu cho phản hồi. Khi người dùng gửi biểu mẫu, hành động có tên actionName sẽ xử lý yêu cầu.

public:
 virtual Microsoft::AspNetCore::Mvc::Rendering::MvcForm ^ BeginForm(System::String ^ actionName, System::String ^ controllerName, System::Object ^ routeValues, Microsoft::AspNetCore::Mvc::Rendering::FormMethod method, Nullable antiforgery, System::Object ^ htmlAttributes);
public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, bool? antiforgery, object htmlAttributes);
abstract member BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
override this.BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
Public Function BeginForm (actionName As String, controllerName As String, routeValues As Object, method As FormMethod, antiforgery As Nullable(Of Boolean), htmlAttributes As Object) As MvcForm

Thông số

chuỗi hành động String

Tên của phương thức hành động.

Chuỗi tên điều khiển String

Tên của bộ điều khiển.

Đối tượng Routevalues Object

Một đối tượng chứa các tham số cho một tuyến đường. Các tham số được truy xuất thông qua phản xạ bằng cách kiểm tra các thuộc tính của đối tượng. Đối tượng này thường được tạo bằng cú pháp khởi tạo đối tượng. Ngoài ra, một thể hiện Id -id có chứa các tham số tuyến đường.

Phương pháp FormMethod FormMethod

Phương pháp HTTP để xử lý biểu mẫu, hoặc nhận hoặc đăng.

Khả năng chống chống lại Nullable

Nếu true, các yếu tố sẽ bao gồm một mã thông báo chống vi khuẩn. Nếu false, hãy triệt tiêu thế hệ một loại "ẩn" bằng mã thông báo chống đối. Nếu null, các yếu tố sẽ chỉ bao gồm mã thông báo chống vi khuẩn chỉ khi

console.log(result[1]) 
0 không nhận được.

Trả lại

MVCForm

Một ví dụ MVCForm làm cho thẻ cuối khi được xử lý.

Thực hiện

Áp dụng cho

Giao diện

console.log(result[1]) 
1 biểu thị các phần tử
console.log(result[1]) 
2 và kế thừa tất cả các thuộc tính và phương thức của giao diện
console.log(result[1]) 
3.
console.log(result[1]) 
1
interface represents
console.log(result[1]) 
2 elements and inherits all properties and methods of the
console.log(result[1]) 
3 interface.

EventTarget Node Element HTMLelement HTMLOptionEuity

Người xây dựng

console.log(result[1]) 
4

Trả về một đối tượng

console.log(result[1]) 
1 mới được tạo. Nó có bốn tham số: văn bản để hiển thị,
console.log(result[1]) 
6, giá trị liên quan,
console.log(result[1]) 
7, giá trị của
console.log(result[1]) 
8 và giá trị của
console.log(result[1]) 
9. Ba tham số cuối cùng là tùy chọn.

Thuộc tính thể hiện

Kế thừa các thuộc tính từ cha mẹ của nó,

console.log(result[1]) 
3.

public:
 virtual Microsoft::AspNetCore::Mvc::Rendering::MvcForm ^ BeginForm(System::String ^ actionName, System::String ^ controllerName, System::Object ^ routeValues, Microsoft::AspNetCore::Mvc::Rendering::FormMethod method, Nullable antiforgery, System::Object ^ htmlAttributes);
1

Có giá trị là true hoặc false hiển thị giá trị ban đầu của thuộc tính

console.log(result[1]) 
9 HTML, cho biết tùy chọn có được chọn theo mặc định hay không.

public:
 virtual Microsoft::AspNetCore::Mvc::Rendering::MvcForm ^ BeginForm(System::String ^ actionName, System::String ^ controllerName, System::Object ^ routeValues, Microsoft::AspNetCore::Mvc::Rendering::FormMethod method, Nullable antiforgery, System::Object ^ htmlAttributes);
5

Có giá trị true hoặc false biểu thị giá trị của thuộc tính

public:
 virtual Microsoft::AspNetCore::Mvc::Rendering::MvcForm ^ BeginForm(System::String ^ actionName, System::String ^ controllerName, System::Object ^ routeValues, Microsoft::AspNetCore::Mvc::Rendering::FormMethod method, Nullable antiforgery, System::Object ^ htmlAttributes);
8 HTML, cho thấy tùy chọn không có sẵn sẽ được chọn. Một tùy chọn cũng có thể bị vô hiệu hóa nếu đó là một đứa trẻ của một phần tử
public:
 virtual Microsoft::AspNetCore::Mvc::Rendering::MvcForm ^ BeginForm(System::String ^ actionName, System::String ^ controllerName, System::Object ^ routeValues, Microsoft::AspNetCore::Mvc::Rendering::FormMethod method, Nullable antiforgery, System::Object ^ htmlAttributes);
9 bị vô hiệu hóa.

public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, bool? antiforgery, object htmlAttributes);
0 Chỉ đọcRead only

A

public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, bool? antiforgery, object htmlAttributes);
1 đại diện cho cùng giá trị với
public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, bool? antiforgery, object htmlAttributes);
2 của phần tử
public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, bool? antiforgery, object htmlAttributes);
3 tương ứng, nếu tùy chọn là hậu duệ của phần tử
public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, bool? antiforgery, object htmlAttributes);
3 hoặc null nếu không tìm thấy.

public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, bool? antiforgery, object htmlAttributes);
5 Chỉ đọcRead only

A

public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, bool? antiforgery, object htmlAttributes);
6 đại diện cho vị trí của tùy chọn trong danh sách các tùy chọn mà nó thuộc về, theo thứ tự cây. Nếu tùy chọn không phải là một phần của danh sách các tùy chọn, như khi nó là một phần của phần tử
public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, bool? antiforgery, object htmlAttributes);
7, giá trị là
public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, bool? antiforgery, object htmlAttributes);
8.

public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, bool? antiforgery, object htmlAttributes);
9 Chỉ đọcRead only

Một chuỗi phản ánh giá trị của thuộc tính

abstract member BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
override this.BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
0 HTML, cung cấp nhãn cho tùy chọn. Nếu thuộc tính này không được đặt cụ thể, hãy đọc nó trả về nội dung văn bản của phần tử.

abstract member BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
override this.BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
1

Có giá trị là true hoặc false cho biết liệu tùy chọn hiện được chọn.

abstract member BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
override this.BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
4

Một chuỗi chứa nội dung văn bản của phần tử.

abstract member BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
override this.BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
5

Một chuỗi phản ánh giá trị của thuộc tính

console.log(result[1]) 
7 HTML, nếu nó tồn tại; Nếu không, phản ánh giá trị của thuộc tính
abstract member BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
override this.BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
7.

Phương pháp thể hiện

Không thực hiện bất kỳ phương pháp cụ thể nào, nhưng kế thừa các phương thức từ cha mẹ của nó,

console.log(result[1]) 
3.

Thông số kỹ thuật

Sự chỉ rõ
Tiêu chuẩn HTML # HTMLOPTIONEMENT
# htmloptionelement

Tính tương thích của trình duyệt web

Bảng BCD chỉ tải trong trình duyệt

Xem thêm

  • Phần tử HTML thực hiện giao diện này:
    console.log(result[1]) 
    
    2.