Want to build the ChatGPT based Apps? Start here
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
zeeshan akram
1.9k
323
13.6k
using jquery Model pop data not show on textbox
Mar 3 2020 2:31 AM
How to show data in model pop , i also put the break point and check data , data is show and pass but not show on the text box . any expert can you tell me where i am wrong .
<
div
class
=
"modal-body"
>
<
div
class
=
"row"
>
<
div
class
=
"col-md-12"
>
<
div
class
=
"panel widget"
>
<
div
class
=
"panel-body"
>
<
form
class
=
"form-horizontal"
action
=
"#"
role
=
"form"
>
<
div
class
=
"panel-heading vd_bg-grey"
>
<
h3
class
=
"panel-title"
>
<
span
class
=
"menu-icon"
>
<
i
class
=
"fa fa-bar-chart-o"
>
</
i
>
</
span
>
Products Info
</
h3
>
</
div
>
<
br
/>
<
div
class
=
"row"
>
<
div
class
=
"col-md-4"
>
<
label
class
=
"col-xs-3 control-label"
>
Name
</
label
>
<
div
class
=
"controls col-xs-9"
>
<
input
type
=
"text"
placeholder
=
"Product Name"
name
=
""
class
=
"input-border-btm"
id
=
"PName"
>
</
div
>
</
div
>
<
div
class
=
"col-md-4"
>
<
label
class
=
"col-xs-3 control-label"
>
Model
</
label
>
<
div
class
=
"controls col-xs-9"
>
<
input
type
=
"text"
placeholder
=
"Model"
name
=
"Model"
id
=
"Model"
class
=
"input-border-btm"
>
</
div
>
</
div
>
</
div
>
</
div
>
<!-- Panel Widget -->
</
div
>
<!-- col-md-12 -->
</
div
>
<
div
class
=
"modal-footer"
>
<
button
type
=
"button"
class
=
"btn btn-secondary"
data-dismiss
=
"modal"
>
Close
</
button
>
<
button
type
=
"button"
class
=
"btn btn-primary"
id
=
"btnUpdate"
style
=
"display:none;"
>
Update
</
button
>
<
button
type
=
"button"
class
=
"btn btn-primary"
id
=
"btnSave"
>
Save changes
</
button
>
</
div
>
</
form
>
</
div
>
</
div
>
<!-- Panel Widget -->
</
div
>
<!-- col-md-12 -->
</
div
>
</
div
>
</
div
>
Function in Jquery
function
GetProductByID(ID)
{
$(
'#PName'
).css(
'border-color'
,
'lightgrey'
);
$(
'#Model'
).css(
'border-color'
,
'lightgrey'
);
$(
'#Condition'
).css(
'border-color'
,
'lightgrey'
);
$.ajax({
url:
"/Items/GetProd/"
+ ID,
typr:
"GET"
,
contentType:
"application/json;charset=UTF-8"
,
dataType:
"json"
,
success:
function
(result) {
$(
'#PName'
).val(result.PName);
$(
'#Model'
).val(result.Model);
$(
'#mproduct'
).modal(
'show'
);
$(
'#btnUpdate'
).show();
$(
'#btnSave'
).hide();
},
error:
function
(errormessage) {
alert(errormessage.responseText);
}
});
return
false
;
}
Jquery Datatable
<script type=
"text/javascript"
>
$(document).ready(
function
() {
mProductList();
});
//Load Data function
function
mProductList() {
$(
"#productlist"
).DataTable({
"processing"
:
true
,
"serverSide"
:
true
,
"filter"
:
true
,
"orderMulti"
:
false
,
"stripeClasses"
: [
'odd-row'
,
'even-row'
],
"ajax"
: {
"url"
:
"/Items/Product_List"
,
"type"
:
"POST"
,
"datatype"
:
"json"
},
"columnDefs"
:
[{
"targets"
: [0],
"visible"
:
false
,
"searchable"
:
false
}],
"columns"
: [
{
"data"
:
"ProductID"
,
"name"
:
"ProductID"
,
"autoWidth"
:
true
},
{
"data"
:
"PName"
,
"name"
:
"PName"
,
"autoWidth"
:
true
},
{
"data"
:
"Model"
,
"name"
:
"Model"
,
"autoWidth"
:
true
},
{
"data"
:
"Condition"
,
"name"
:
"Condition"
,
"autoWidth"
:
true
},
{
"data"
:
"UnitPrice"
,
"name"
:
"UnitPrice"
,
"autoWidth"
:
true
},
{
"data"
:
"Discount"
,
"name"
:
"Discount"
,
"autoWidth"
:
true
},
{
"data"
:
"ProductSize"
,
"name"
:
"ProductSize"
,
"autoWidth"
:
true
},
{
"data"
:
"ProductColor"
,
"name"
:
"ProductColor"
,
"autoWidth"
:
true
},
{
"data"
:
"ProductType"
,
"name"
:
"ProductType"
,
"autoWidth"
:
true
},
{
"data"
:
"UnitInStock"
,
"name"
:
"UnitInStock"
,
"autoWidth"
:
true
},
{
data:
null
, render:
function
(data, type, row) {
return
"<a href='#' class='btn btn-sm btn-info' onclick=GetProductByID('"
+ row.ProductID +
"'); ><i class='fa fa-eye'></i></a>"
;
}
},
]
});
}
function
public
JsonResult GetProd(
int
id)
{
ECommercedbEntities db =
new
ECommercedbEntities();
var productl = (from p
in
db.Products
where p.ProductID == id
select
new
{
PName = p.PName,
PDescription = p.PDescription,
Model = p.Model,
}).FirstOrDefault();
var productD = (from pd
in
db.ProductDetails
join p
in
db.Products on pd.ProductID equals p.ProductID
where pd.ProductID == id
select
new
{
ProductID = pd.ProductID,
OS = pd.OS,
ProcessorType = pd.ProcessorType,
RAM = pd.RAM,
ScreenSize = pd.ScreenSize,
TouchScreen = pd.TouchScreen,
BatteryLife = pd.BatteryLife,
Camera = pd.Camera
}).ToList();
return
Json(
new
{ productl, productD }, JsonRequestBehavior.AllowGet);
//var plist= _IProducts.GetProductByID(id);
}
Reply
Answers (
4
)
complete source code of uploading video in grid
Looking for help with WinForms Performance issue resizing co