|
HttpPostedFileBase model property is not getting in click function in jquery ajax
|
|
|
|
|
Not really a good post now, is it? Give more details, show some relevant code and tell where the problem is. Also, share what you have tried so far so people do not recommend same thing again.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
$("#btnSubmit").click(function (event) {
$.ajax({
url: actionMethod,
type: "POST",
data: $("#myFormID").serialize(), //here the file type not get post(it is the issue)
cache: false,
datatype: "json",
processData: false,
success: function (result) {
//doing my task
}
})
return false;
}
if i use submit i can get file type value (HttpPostedFileBase) value but i was doing some client side validations so i need this in click event.
|
|
|
|
|
|
Hi all,
I have a Kendo Grid as below, it creates a Popup that will submit the Data entered by using into a Controller Action method, my need is, I have a jQuery function that will be called at RequestStart, which has some validations, what I want is, to prevent calling of the calling of the Controller Action method if Validation fails like in the jQuery method <2, or < 3 or etc, any help would be very very helpful, I am using Kendo grid for it, my Kendo grid is as below:
<div class="row table-responsive " style="padding-left: 3%">
<div id="datalist">
@(Html.Kendo().Grid<DHCS.BH.Provider.Models.LookupTable>()
.Name("LookupGrid")
.EnableCustomBinding(true)
.AutoBind(true)
.Columns(columns =>
{
columns.Bound(p => p.Id).Hidden();
columns.Bound(p => p.Code).Width(120);
columns.Bound(p => p.Description).Width(280);
columns.Bound(p => p.CreatedDate).ClientTemplate("#=DateFormat(CreatedDate)#").Width(130);
columns.Bound(p => p.CreatedBy).Width(150);
columns.Bound(p => p.ModifiedDate).ClientTemplate("#=DateFormat(ModifiedDate)#").Width(140); ;
columns.Bound(p => p.ModifiedBy).Width(150);
columns.Bound(p => p.Status).Width(100);
columns.Bound(p => p.IsValid).Width(100).Hidden();<br />
columns.Command(command => { command.Edit().UpdateText("OK").CancelText("Cancel");}).Width(100);
columns.Bound(p => p.LookupTableId).Hidden();
columns.Bound(p => p.ForeignKeyId).Hidden();
})<br />
.ToolBar(toolbar =>
{
toolbar.Create().Text("Add New");
})
.Editable(editable => { editable.Mode(GridEditMode.PopUp).TemplateName("_EditLookupCode").DisplayDeleteConfirmation(false); })
.Pageable()
.Resizable(resize => resize.Columns(true))
.Sortable()
.Scrollable()
.Resizable(resize => resize.Columns(true))
.Filterable(x => x.Extra(false).Operators(O => O.ForString(str => str.Clear().StartsWith("Starts With"))))
.HtmlAttributes(new { style = "height:550px;" })
<pre>
.Events(events => events.Edit("LookupPopUpTitle")
.DataBound("dataBoundAdmin")
)
.DataSource(ds => ds
.Ajax()
.PageSize(10)
.Model(model => { model.Id(p => p.Id); })
.Read(read => read.Action("GetLookupValues", "Admin").Data("GetLookupTableId"))
.Create(create => create.Action("AddLookupRecord", "Admin").Data("GetLookupTableId")).Events(e => e.Sync("GetLookupTableValue1"))
.Update(update => update.Action("UpdateLookupRecord", "Admin"))
.Events(e => e.RequestStart("onRequestStart"))
)
)
</div>
And my jQuery method is:
function onRequestStart(e)
{
var v = $("#txtLookupTableId").val();
if ((v == 3) || (v == 20))
{
if ($('#idTxtForCodeLookupCode').val().length<2)
e.preventDefault();
}
else if ((v == 6) || (v == 7) || (v == 8) || (v == 9) || (v == 12) || (v == 23))
{
if ($('#idTxtForCodeLookupCode').val().length < 2)
e.preventDefault();
}
else if ((v == 11) || (v == 13))
{
if ($('#idTxtForCodeLookupCode').val().length < 3)
e.preventDefault();
}
else if ((v == 15))
{
if ($('#idTxtForCodeLookupCode').val().length < 3)
e.preventDefault();
}
else if (v == 2)
{
if ($('#idTxtForCodeLookupCode').val().length < 15)
e.preventDefault();
}
else if ((v == 16) || (v == 17) || (v == 18))
{
if ($('#idTxtForCodeLookupCode').val().length < 25)
e.preventDefault();
}
else if (v == 22)
{
if ($('#idTxtForCodeLookupCode').val().length < 10)
e.preventDefault();
}
else if (v == 26)
{
if ($('#idTxtForCode').val().length < 2)
e.preventDefault();
}
else
{
$('#idTxtForCodeLookupCode').NoCondition();
$('#lblCodeValidationMessage').text("");
}
}
Any help please? Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
I don't understand why you keep posting queries related to Kendo UI controls here in ASP.NET forum section. Again, to get quick answer to your query, you should post it at Telerik dedicated forums: Forum threads about Grid Kendo UI for jQuery[^]
Or atleast at JavaScript forums section: JavaScript Discussion Boards[^]
You'd likely get less response or perhaps nothing at all when posting queries to wrong forum section.
modified 3-Aug-18 12:10pm.
|
|
|
|
|
The reason is, Telerik allows only members or licensed user to post queries, that's very sad, and I am not a member and as organization I am working in is big, so not sure on whose credentials license is registered with.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
I got you. But if you are working in an organization, you should have a team license for it. Why use a paid third-party products when you can't get a full support from them? Go ask your boss and ask for the credentials so you would be able to contact their support or post to their forums when you have problems specific to their products.
PS: Their site states that Community questions can be directed to the: KenduUI - Stack Overflow[^]
|
|
|
|
|
Any specific reason not to use jQuery Unobtrusive validation library?
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
I am not familiar with that, I am new to MVC, can you please help me with that please?
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Check out MSDN. This is recommended practice for client side validation.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
Hi,
I am working in asp.net WCF Service with sql server stored procedure for connecting an android application. I am using Visual Studio 2010 Professional and sql server 2008.
Anyone can help me to solve the problem with thestep by step procedure to create WCF service and hosting it in iis?
modified 2-Aug-18 8:26am.
|
|
|
|
|
This forum section is intended for ASP.NET related specific issues, there might be some folks here who knows WCF but I guess you stand a better chance on getting help when posting your issue at WCF dedicated forums.
|
|
|
|
|
Okay. i posted this question because of asp.net. if anyone knows about asp.net wcf service please let us know.
|
|
|
|
|
Try searching the articles or create WCF service and hosting it in iis - Google Search[^].
This is basic research which cannot be done by anyone else, you need to learn how to research your subject and a lot of that is getting the correct search terms - I used your question and got an excellent collection of results.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Am using html2pdf js for conversion of html to pdf, in this ordered list and unordered list types are not working.Can any one help to overcome this issue.
Thanks in Advance.
|
|
|
|
|
which HTML2pdf you were using?
|
|
|
|
|
Thank you for your response.
Below mentioned link is what am using.(html2pdf.js code is present below the page)
https://github.com/MrRio/jsPDF/blob/master/docs/libs_html2pdf.js.html
Thanks& regards
|
|
|
|
|
Your best shot on getting answers is to submit an issue at: https://github.com/MrRio/jsPDF/issues
This forum section is intended for ASP.NET in general, there might be some folks here who knows HTML2PDF that you were using but I guess you stand a better chance on getting help when posting your issue directly to link I've given.
|
|
|
|
|
ParentPage.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ParentPage.aspx.cs" Inherits="ParentPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<iframe src="ChildPage.aspx" id="frameid" width="500" height="500" style="background-color: #00FF00"></iframe>
<iframe src="ChildPage2.aspx" id="frameid2" width="500" height="500" style="background-color: #00FFFF"></iframe>
</div>
</form>
</body>
</html>
ChildPage.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ChildPage.aspx.cs" Inherits="ChildPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
/* The Modal (background) /
.modal {
display: none; / Hidden by default /
position: fixed; / Stay in place /
z-index: 1; / Sit on top /
padding-top: 100px; / Location of the box /
left: 0;
top: 0;
width: 100%; / Full width /
height: 100%; / Full height /
overflow: auto; / Enable scroll if needed /
background-color: rgb(0,0,0); / Fallback color /
background-color: rgba(0,0,0,0.4); / Black w/ opacity */
}
/* Modal Content */
.modal-content {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
border: 1px solid #888;
width: 80%;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
-webkit-animation-name: animatetop;
-webkit-animation-duration: 0.4s;
animation-name: animatetop;
animation-duration: 0.4s
}
/* Add Animation */
@-webkit-keyframes animatetop {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
@keyframes animatetop {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
/* The Close Button */
.close {
color: white;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
.modal-header {
padding: 2px 16px;
background-color: #5cb85c;
color: white;
}
.modal-body {padding: 2px 16px;}
.modal-footer {
padding: 2px 16px;
background-color: #5cb85c;
color: white;
}
</style>
</head>
<body>
<h2>Animated Modal with Header and Footer</h2>
<!-- Trigger/Open The Modal -->
<button id="myBtn">Open Modal</button>
<div id="myModal" class="modal" >
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
×
<h2>Modal Header</h2>
</div>
<div class="modal-body">
<p>Some text in the Modal Body</p>
<p>Some other text...</p>
</div>
<div class="modal-footer">
<h3>Modal Footer</h3>
</div>
</div>
</div>
<script>
// Get the modal
var modal = document.getElementById('myModal');
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
<pre>
modal.style.display = "block";
}
// When the user clicks on (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
$(document).ready(function(){
modal.style.display = "block";
});
}
ChildPage2.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ChildPage2.aspx.cs" Inherits="ChildPage2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<pre>
</div>
</form>
How Can I Open the Iframe's modal popup on Parent Page, Not on Child's page?
|
|
|
|
|
|
Hi All,
I want to hide span which has class k-icon k-i-close but don't want to hide spam with class: k-icon k-i-edit,
<td role="gridcell">
<a role="button" class="k-button k-button-icontext k-grid-edit" href="#">
Edit
</a>
<a role="button" class="k-button k-button-icontext k-grid-delete" href="#">
Delete
</a>
</td>
I have tried in the below way:
.k-button.k-button-icontext .k-icon, .k-button.k-button-icontext .k-image
{
visibility:hidden;
}
But it is hiding images of all buttons, but I want to only hide delete buttons image using css class. I have tried in the below way also but its not hiding the delete buttons icon, I just want to hide the delete buttons icon.
function dataBoundAdmin(e)
{
var data = this.dataSource.view();
for (var i = 0; i < data.length; i++)
{
var uid = data[i].uid;
var row = this.table.find("tr[data-uid='" + uid + "']");
if (data[i].IsValid)
{<br />
row.find(".k-grid-delete").contents().last()[0].textContent = 'Disable';
}
else
{<br />
row.find(".k-grid-delete").contents().last()[0].textContent = 'Enable';
}
}
$(".k-icon k-i-close").hide();
}
Any help is going to be very helpful, thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Ok no problem, I got it resolved in the following way:
function dataBoundAdmin(e)
{
var data = this.dataSource.view();<br />
for (var i = 0; i < data.length; i++)
{
var uid = data[i].uid;
var row = this.table.find("tr[data-uid='" + uid + "']");
row.find(".k-i-close").hide();
if (data[i].IsValid)
{
row.find(".k-grid-delete").contents().last()[0].textContent = 'Disable';
}
else
{
row.find(".k-grid-delete").contents().last()[0].textContent = 'Enable';
}
}
}
Just say if somebody needs similar help.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
If you want to hide .k-i-close but not .k-i-edit , then you need a rule that targets .k-i-close :
.k-button.k-button-icontext .k-i-close
{
visibility:hidden;
}
If you want to do it using jQuery, you'll need a valid selector. Your example is looking for an element called <k-i-close> which is a descendant of an element with class="k-icon" - that doesn't match your markup. Try:
$(".k-icon.k-i-close").hide(); Class Selector (“.class”) | jQuery API Documentation[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
Am having two folders in my project containing two login.aspx pages of same name. So is it possible to use only one code behind page(login.aspx.cs) for two pages.
Please suggest me solution. Thanks in Advance.
|
|
|
|