|
Depends on the version of JQuery your using. The call changes as versions are updated.
Technically, JQuery can select an element anywhere on the page or in the DOM, even if it's hidden.
Best thing to do is test first. just have the function write an alert to see if it works first, then write your code to do it's thing.
$("#idTxtForCodeLookupCode").on('blur', function ()
$("#idTxtForCodeLookupCode").blur(function() {
focus, blur, keyup is very tricky and requires more code to listen to certain keys.
I'm going to a seminar, the post JQuery world, in which basically JQuery is no longer needed with modern JavaScript and TypeScript being available now. Something for us to think about.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
The meetup was pretty cool. Technically we don't need JQuery anymore for modern browsers that support HTML5, because modern JavaScript is now part of the browser. You save a 2 meg download on pages that use JQuery. There are many small npm libraries like animate.css that are around 64K in size that can do animation for you and Ajax is built in now.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Hi all,
I have overridden GetValidators method of CustomModelValidatorProvider in class CustomModelValidatorProvider, when a Post is happening, this Validator is getting all the values that I have input on the screen but I have Hidden field that I want to pass into this method is not coming in.
public class CustomModelValidatorProvider : System.Web.Mvc.DataAnnotationsModelValidatorProvider
{
protected override IEnumerable<System.Web.Mvc.ModelValidator> GetValidators(System.Web.Mvc.ModelMetadata metadata, ControllerContext context, IEnumerable<Attribute> attributes)
{
var z = metadata.PropertyName;
if ((metadata.PropertyName == "Code")
&& (metadata.ContainerType.FullName == "DHCS.BH.Provider.Models.LookupTable"))
{
LookupTable model = metadata.Container as LookupTable;
var newAttributes = new List<Attribute>(attributes);
var stringLength = newAttributes.OfType<StringLengthAttribute>().FirstOrDefault();
if (stringLength != null)
{
newAttributes.Remove(stringLength);
if (model.CodeLength != 0)
{
newAttributes.Add(new StringLengthAttribute(model.CodeLength)
{
MinimumLength = model.CodeLength,
ErrorMessage = @"The field {{0}} length must be at least {model.CodeLength}."
});
}
attributes = newAttributes;
}
}
return base.GetValidators(metadata, context, attributes);
}
public string GetPropertyName<T>(Expression<Func<T>> propertyLambda)
{
var me = propertyLambda.Body as MemberExpression;
if (me == null)
{
throw new ArgumentException("You must pass a lambda of the form: '() => Class.Property' or '() => object.Property'");
}
return me.Member.Name;
}
}
My cshtml file is as below, it is a Popup that's being generated for Create and Edit buttons of Kendo Grid.
@model DHCS.BH.Provider.Models.LookupTable
@{
ViewBag.Title = "EditLookup";
}
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<pre>
<div class="k-edit-form-container">
@*<div class="editor-field">
@Html.Kendo().TextBoxFor(model => model.LookupTableId).HtmlAttributes(new { autocomplete = "off", id = "idXYZ" })
</div>*@
@Html.HiddenFor(model => model.LookupTableId, new { id = "txtLookupTableId" })
<div class="editor-label">
@Html.LabelFor(model => model.Code)
</div>
<div class="editor-field">
@Html.Kendo().TextBoxFor(model => model.Code).HtmlAttributes(new { autocomplete = "off", id = "idTxtForCodeLookupCode" })<br />
<br />
<label id="lblCodeValidationMessage" style="color:gray;font-style:italic;font-size:smaller;font-weight:normal;">Testing</label>
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
@Html.Kendo().TextBoxFor(model => model.Description).HtmlAttributes(new { autocomplete = "off", id = "idTxtForDescLookupCode" })
<label id="lblDescriptionValidationMessage" style="color:gray;font-style:italic;font-size:x-small;font-weight:normal;"></label><br />
</div>
<div class="editor-label" >
<label id="lblIsValid">Is Active: </label>
</div>
<div class="editor-field" style="padding-top: 10px;">
@Html.Kendo().CheckBoxFor(model => model.IsValid)
</div>
</div>
}
SetLookupTableValue();
And method SetLookupTableValue sets the value of the HiddenField txtLookupTableId, when I click on the save all other Textbox and Checkbox values coming in the model of the above GetValidators method but the LookupTableId value is coming as null, any help for this would very great help, thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Are you sure that txtLookupTableId is being set correctly?
You can use a tool like Fiddler[^] to inspect the raw HTTP post to check the value coming in.
|
|
|
|
|
Yes I mean in the JavaScript function but I am not sure if something else is happening between the RequestEnd javascript function call and opening the Popup.
I want to write a text changed event for the Kendo Textbox, idTxtForCodeLookupCode, can you please help me how to write it using jquery, maybe if I assign value to the HiddenField: txtLookupTableId, it would be good.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
With this code:
@Html.HiddenFor(model => model.LookupTableId, new { id = "txtLookupTableId" })
You are setting the value of the hidden field to whatever is in your model's LookupTableId property. This is done on the server side when the view is rendered.
I don't know anything about Kendo components so I can't help you there. For a troubleshooting approach on the client side, try using the developer tools built in to the browser (F12 on chrome). You can set breakpoints and log to the console using console.log. This should help you see what is going on in your event handler.
Good luck!
|
|
|
|
|
I a new to web service project . I'm getting HTTP Error 403.14 - Forbidden whenever I debug my .asmx web service project . It says
HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.
to enable directory but it's not going to work . How to solve this error? Please Help? Any clue will be helpful .
EDIT
I added
<system.webserver>
<directorybrowse enabled="true">
this into web.config now I can see all the directory content but whenever I click .cs a page I get this error HTTP Error 404.7 - Not Found The request filtering module is configured to deny the file extension.
And
when I click the .asmx project I get the parser error
Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
I am debugging my project in local
|
|
|
|
|
sudipta saha wrote: Please review the following specific parse error details and modify your source file appropriately.
So what happened after you reviewed the specific parse error details and modified your source files?
If you want someone here to help you fix the errors in your code, then we need to see the relevant parts of your code, the full details of the errors.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi thank you for your reply Smile | . my project's url is localhost:3525 that's all . But my production site's url is http://abcdef.com/maidweb/ . whenever I'm trying to debug my project it gives me 403.14 error and says to enable directory . I wrote this enabled = true then I can see the content of directories but when I click into asmx project it says
Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Detailed Error
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type 'abcd.xyz.Services.Endpoints.BaseWebserver'.
Source Error:
Line 1: <%@ WebService Language="C#" CodeBehind="BaseWebService.asmx.cs" Class="abcd.xyz.Services.Endpoints.BaseWebserver" %>
Source File: /BaseWebService.asmx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.8789; ASP.NET Version:2.0.50727.8762
How to solve this error . How to see the output of asmx web service related projects in visual studio 2015 .
|
|
|
|
|
There is not enough information here but I suspect you are trying to access base URL. Are you accessing the asmx file in the URL?
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
Hi thank you for your reply . my project's url is localhost:3525 that's all . But my production site's url is http://abcdef.com/maidweb/ . whenever I'm trying to debug my project it gives me 403.14 error and says to enable directory . I wrote this enabled = true then I can see the content of directories but when I click into asmx project it says
Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Detailed Error
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type 'abcd.xyz.Services.Endpoints.BaseWebserver'.
Source Error:
Line 1: <%@ WebService Language="C#" CodeBehind="BaseWebService.asmx.cs" Class="abcd.xyz.Services.Endpoints.BaseWebserver" %>
Source File: /BaseWebService.asmx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.8789; ASP.NET Version:2.0.50727.8762
How to solve this error . How to see the output of asmx web service related projects in visual studio 2015 .
|
|
|
|
|
Parser error could occur because your asmx file is not valid. The error would provide line number along with more details to sort out the problem.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
Hi,
Actually you are right class name wasn't correct at all . my file name was BaseService.asmx and I wrote BaseServer instead of writing BaseService . But htnl page isn't loading at all . Still some issue is there but finally it opened . Thanks
|
|
|
|
|
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.
|
|
|
|