Click here to Skip to main content
15,896,063 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
jkirkerx18-Jul-18 9:00
professionaljkirkerx18-Jul-18 9:00 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
indian14318-Jul-18 9:06
indian14318-Jul-18 9:06 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
jkirkerx18-Jul-18 9:13
professionaljkirkerx18-Jul-18 9:13 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
indian14318-Jul-18 10:23
indian14318-Jul-18 10:23 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
jkirkerx18-Jul-18 10:26
professionaljkirkerx18-Jul-18 10:26 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
indian14318-Jul-18 12:38
indian14318-Jul-18 12:38 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
jkirkerx18-Jul-18 13:12
professionaljkirkerx18-Jul-18 13:12 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
indian14318-Jul-18 14:33
indian14318-Jul-18 14:33 
The problem is I can't use these attributes (type = "number", pattern = "[0-9]*", inputmode = "numeric"), because they need to change depending upon the selection or value of the selected value of the dropdown list.

But I could able to find the reason why its not working, because the textbox is in a partial view and as I am loading the partial view multiple times those functions are getting loaded multiple times, even if I use within document.ready, still it would be added multiple times. As I am opening the partial view as in the below Kendo grid popup , is there any way to clean this up once I close the popup or finish my task?
Page: Lookup2
    <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(200);
                    columns.Bound(p => p.Description).Width(290);
                    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.IsValid).Width(100).Hidden();
                    ////columns.Command(command => { command.Custom("View").Click("ViewLookupTableValues").HtmlAttributes(new { @class = "k-primary" }); }).Width(100);
                    columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
                    columns.Bound(p => p.LookupTableId).Hidden();
                    columns.Bound(p => p.ForeignKeyId).Hidden();
                })
                 .ToolBar(toolbar =>
                        {
                            toolbar.Create().Text("Add New");//.HtmlAttributes(new { @class = "k-button" });
                        })//.HtmlAttributes(new { @class = "btn btn-primary" })
                            .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("_EditLookupCode"))
                    .Pageable()
                    .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"))

            .DataSource(ds => ds
                .Ajax()
                .PageSize(10)
                    .Model(model => { model.Id(p => p.Id); })
                    .Read(read => read.Action("GetLookupValues", "Admin").Data("GetLookupTableId"))
                    .Create(update => update.Action("AddLookupRecord", "Admin").Data("GetLookupTableId")).Events(e => e.Sync("GetLookupTableValue1"))
                //.Create(c => c.)
                    .Update(update => update.Action("UpdateLookupRecord", "Admin"))//.Data("GetLookupTableId"))
                    .Destroy(update => update.Action("DeleteLookupRecordById", "Admin"))
                )
    )



Even this grid is also within Partial View and I am loading it by using javascript funtion as below:
Page name: lookup 1
var url = '../Admin/GetLookupTableCode';
            $("#divLookupTable").load(url, { LookupTableId: $("#drpLookup").data("kendoDropDownList").value() });

seems that I need to clean these partial views once I am done with them, as the problem is happening in the Add New call of the Page: Lookup 2, I would need to clean it up it seems, (how did I come to this conclusion, because first time it worked properly then second time onward it started giving me problems), any help would be very very helpful my friend, I spent lot of time on it, thanks for understanding my friend.

or in simple, is there any way I can remove the document.ready that has been loaded and reload it again with the partial view load, because the if condition and function calls are not working directly if I am writing under script task like

if (x==y)
alert("Hi");

But works only once if I write the following within partial view cshtml

document.ready()(function({
if (x==y)
alert("Hi");
});

But this doesn't work, more than once maybe because it can not work if document.ready is loaded multiple times.
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."

-- modified 18-Jul-18 21:45pm.
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
jkirkerx19-Jul-18 7:09
professionaljkirkerx19-Jul-18 7:09 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
indian14319-Jul-18 7:47
indian14319-Jul-18 7:47 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
jkirkerx19-Jul-18 8:46
professionaljkirkerx19-Jul-18 8:46 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
indian14319-Jul-18 9:09
indian14319-Jul-18 9:09 
GeneralRe: Conditionally Loading Partial View in a Page using Javascript Pin
indian14319-Jul-18 11:21
indian14319-Jul-18 11:21 
Questiongetting these smtp exceptions in my mvc .net project,used different ports but still not workin ,can u plz help me? Pin
Member 1390903412-Jul-18 3:32
Member 1390903412-Jul-18 3:32 
AnswerRe: getting these smtp exceptions in my mvc .net project,used different ports but still not workin ,can u plz help me? Pin
F-ES Sitecore12-Jul-18 3:48
professionalF-ES Sitecore12-Jul-18 3:48 
AnswerRe: getting these smtp exceptions in my mvc .net project,used different ports but still not workin ,can u plz help me? Pin
jkirkerx18-Jul-18 13:14
professionaljkirkerx18-Jul-18 13:14 
QuestionDefault Download button is not working in Chrome browser Pin
Member 1370125111-Jul-18 19:54
Member 1370125111-Jul-18 19:54 
AnswerRe: Default Download button is not working in Chrome browser Pin
Richard Deeming12-Jul-18 1:03
mveRichard Deeming12-Jul-18 1:03 
Question.Net Core 2.1, Favicon.ico, robots.txt, sitemap.xml, google verification file Pin
jkirkerx8-Jul-18 12:26
professionaljkirkerx8-Jul-18 12:26 
AnswerRe: .Net Core 2.1, Favicon.ico, robots.txt, sitemap.xml, google verification file [solved] Pin
jkirkerx9-Jul-18 7:31
professionaljkirkerx9-Jul-18 7:31 
QuestionCouldn't retrieve all records from SQL database in c# Pin
Sehal6-Jul-18 23:12
Sehal6-Jul-18 23:12 
AnswerRe: Couldn't retrieve all records from SQL database in c# Pin
Mycroft Holmes7-Jul-18 13:44
professionalMycroft Holmes7-Jul-18 13:44 
SuggestionRe: Couldn't retrieve all records from SQL database in c# Pin
Richard Deeming9-Jul-18 8:43
mveRichard Deeming9-Jul-18 8:43 
Question.Net Core 2.1 with SQLite, ReactJS.net and JavascriptRenderingEngine, Porting my first app over to it was really hard Pin
jkirkerx6-Jul-18 8:31
professionaljkirkerx6-Jul-18 8:31 
QuestionHow to use angular along with ASP.NET mvc project Pin
Nitin S4-Jul-18 20:37
professionalNitin S4-Jul-18 20:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.