Subscribe: Custom Server Controls
http://forums.asp.net/rss.aspx?ForumID=19
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
auto style  auto  controller  data  listitem listitem  listitem  runat server  runat  server  style auto  style  text  user  var 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Custom Server Controls

All Forums



All Forums



Last Build Date: Tue, 25 Jul 2017 09:50:33 -0700

 



A label won't update if dropdown is inside updatepanel

2017-07-25T16:40:37.473-07:00

The SelectedIndexChanged event fires properly and execute the code without any errors. The last thing I do in it is to set the value of a label which isn't updated. If I move the TD element inside updatepanel then it will refresh the label but screen flashes and I am trying to avoid the screen flash.


    
        
            
        
    


    
        
            
        
    

The code below does update the label:

    
        
        
            
        
        
    
    
        
        
            
        
        
    

The only code I have in ddlF1 and ddlF2's SelectIndexChange is  lblTemp = "My Test";




Authorize attribute not working

2017-07-24T13:47:30.827-07:00

I have an ASP.NET MVC (version 5.2.3) web application using Individual User Accounts and .NET Framework 4.5.1.  For some reason the Authorize attribute on my controller classes no longer works.  I can log into the website as a user who is NOT in role Admin, Supervisor or WorkcenterA and it still allows me to access the Create method inside the WorkcenterA controller.  It shouldn't allow this.  If I set a breakpoint on the WorkcenterA controller Create method User.IsInRole("Admin") = false and User.IsInRole("Supervisor") = false and User.IsInRole("WorkcenterA") = false so why did it allow the Create page to be accessed?  It's like the Authorize attribute does absolutely nothing.  Can somebody give me a hint as to how I can fix it?  I have researched this issue on Google but all suggestions have failed to resolve my problem.

[Authorize(Roles = "Admin, Supervisor, WorkcenterA")]
public class WorkcenterAController: HelperController
{




Select Query Breaks when Choosing a different DropDown Selection

2017-07-25T16:24:19.903-07:00

Hello, I have created GridView to retrieve comments entered by users. I have provided drop down boxes to filter data: Year, Month, Tab, Section, Order. When users filter it first by year then any other drop down selection, it works fine. When users try to filter the Gridview data by Month, Tab, or Section first I get the error below. ORA-00933: SQL command not properly ended Here is the code: aspx page: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Comments.aspx.cs" Inherits="ChngMgmt_Comments_and_Legends.Comments" %>

Comments

Fill the information below to add new comment
Comment:

Year: 2016 2017 2018 2019 2020 2021 2022 [...]



why Most of the time ajax success function doesn't work in asp.net MVC?

2017-07-25T15:51:53.12-07:00

In my project, I've used datatable for CRUD operation.but I have a problem most of the time didn't work success function, of course, I saw my network tab I received {status:true} but datatable didn't reload and I redirected to the blank page.in fact, if I want to add a record my record will add but it redirects to the blank page. also, I've added alert function into success function it didn't fire.this problem is in Create, Delete, Edit operation. I've read a lot of links on the internet but they couldn't help me. // GET: Admin/Users/Delete/5 public ActionResult Delete(string id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } User user = db.User.Find(id); UserViewModel userViewModel=new UserViewModel(); userViewModel.UserId = user.Id; userViewModel.UserName = user.UserName; userViewModel.FirstName = user.FirstName; userViewModel.LastName = user.LastName; userViewModel.Email = user.Email; userViewModel.IsActive = user.IsActive; userViewModel.Gender = user.Gender; userViewModel.PhoneNumber = user.PhoneNumber; userViewModel.Address = user.Address; if (user == null) { return HttpNotFound(); } return PartialView(userViewModel); } // POST: Admin/Users/Delete/5 [HttpPost, ActionName("Delete")] [ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(string id) { bool status=false; User user = db.User.Find(id); db.User.Remove(user); db.SaveChanges(); return Json(new { status = true }, JsonRequestBehavior.AllowGet); } ========================== @model IEnumerable @{ ViewBag.Title = "مدیریت کاربران"; } @*

مدیریت کاربران

*@ @section Styles{ }
کاربران



Drop Down Boxes do not automatically refresh data

2017-07-25T16:12:30.173-07:00

Hello I have a simple one page CRUD app. Users can add comments and view comments in Grid View on same page. I have provided them with dropdown boxes to filter data as well. The issue is when users enter new data to the database, the dropdown boxes do not include that information. For example if a user entered a comment for year = 2018, month = July, the Year 2018 does not show if it was not previously added by some other user. Where do I need to fix my code? ASPX PAGE: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Comments.aspx.cs" Inherits="ChngMgmt_Comments_and_Legends.Comments" %>

Comments

Fill the information below to add new comment
Comment:

Year: 2016 2017 2018 2019 2020 [...]



Help with using interface methods in my controller

2017-07-25T15:42:51.247-07:00

I have an interface called Office and the following methods are used, how do I access each of these in my controller?

public interface IOfficeService

{

      IEnumerable SelectAll( );

      List GetReposOffice( );

      Hashtable Select_OfficeName(string Name);

      void addOffice(ReposOffice addRecord);

      void updateOffice(ReposOffice updateRecord);

      void Save();  

}

public class OfficeLookup : IOfficeService

{

     DatabaseConn _db = new DatabaseConn( );

     public IEnumerable<ReposOffice> SelectAll ( )

    {

         return _db.ReposOffice.ToList ( ); <-- How to access this from my controller

    }

    

     public Hashtable Select_OfficeName(string name)

     {

           Hashtable _hasTable = new Hashtable ( );

           var _data = _db.ReposOffice...... ;

         _hasTable.Add(..........);

           return     _hasTable<-- how do I access this in my controller?

      }

      public void AddOffice(ReposOffice _add)

     {

           _db.ReposOffice.Add(_add);

           _db.SaveChanges();    <-- how do I add record from controller to be saved into my database?

      }

 

    public void UpdateOffice(ReposOffice _data)

    {

            1.    What goes in here to update a record?

            2.  How do I access this from my controller?

    }

 

}




How modern browser execute javascript code

2017-07-25T12:00:08.483-07:00

i heard that browser use interpreter to execute js code but some one tell me nowadays modern browser use compiler too along with interpreter to execute js code. if this is true then please share a article which tell me in details how nowadays modern browser execute js code.

also give me a link how js v8 engine execute js code.

thanks




New in WCF

2017-07-13T18:14:35.263-07:00

Getting this error at the time of compiling WCF service:

"Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata."

The service encountered an error:

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: http://tempuri.org/:ITIN_EXT_ServiceMobile ----> ..... bla, bla....

My service is:

namespace MyService
{
    using TIN.DataMobile;       

    [ServiceContract]
    public interface ITIN_EXT_ServiceMobile
    {
        [OperationContract]
        string findContact(int eid);

        [OperationContract]
        String addUser(string uID);

        [OperationContract]
        Mob_AddSessionOut Mob_AddSession(Mob_AddSessionIn pInput);
    }
}

The issue is in the last service because all is fine with the first two service.

Where:

public class Mob_AddSessionOut
    {
        public String Auth_token { get; set; }
        public Boolean Transaction_moviment { get; set; }
        public TIN.DataAccessLayer.Gen_StatusProcess StatusProcess { get; set; }    

    }

What am I doing wrong?

Thanks




The resource object with key 'Login' was not found. (asp.net and azure)

2017-07-23T18:20:05.053-07:00

I publish web app and database to azure, and I can link my local to azure database. the web app is working on my local. but I run paxxxxxx.azurewebsites.net, I got the error:

The resource object with key 'Login' was not found.

I open vs2013 and I can find the key in "Resource.us.resx" and "Resource.zh.resx" on "App_GlobalResources" folder.

I am not sure what is going on (the point is the web is working on my local when I link to azure database).

I can find some info on "app service editor":

in "bin", I can find "resources.dll" file in "zh" only, it means I miss "us" file?

thanks for any idea.




SEO + Jquery Issue

2017-04-14T04:53:34.887-07:00

Hi team,

I am facing issue with Jquery , As per our SEO team to rank page Dom element should be render , I mean to say your html should be display on view source , But If i use jquery Dom element not rendering as view source. can any say how to render html using any client side script like jquery,javascript, angular,knockout 

below is example.  

 $(window).scroll(function () {

$.ajax({
url: "/anypage.aspx/Getreview",
data: '{}',
datatype: "json",
type: "POST",
async: true,
cache: true,
contentType: "application/json; charset=utf-8",
beforeSend: function () {
},
success: function (data) {
LodeReview = true;

$("#divReviewlist").html(data.d);

},
error: function (XMLHttpRequest, callStatus, errorThrown) {
alert(XMLHttpRequest.responseText);
alert(XMLHttpRequest.status);
alert(errorThrown);
},
complete: function () {
}
});})

                                            

                                                           




Html 5 Audio control seek is not working.

2017-07-19T11:14:08.83-07:00

Hi ,

i have used Html5 audio control.and after downloading from server we are able to play.but i am not able to seek the control.

we are providing filestream for src.

for ex:-i want to play audio  somewhere from between so want to seek the file ,but unable to seek.




WebGrid Column Format in Razor View (VBHTML)

2017-07-24T19:12:40.133-07:00

I'm trying to vertically align the "Agency" Label column data to the middle or bottom.  It seems stuck at the top.  Please help.  Thanks.

                
@Grid.GetHtml("table table-bordered",,,,,, "Caption",,,, Grid.Columns(Grid.Column("EMP_ID_NUM", "Employee ID"), Grid.Column("L_NAME", "Last Name"), Grid.Column("F_NAME", "First Name"),
Grid.Column(, "Agency", format:=@@
@Html.Label(item.AGY_ABB.ToString, item.AGY_ABB.ToString, New With {.Style = "width:120px;"})
)
,
Grid.Column("VSDP_OPTOUT_PREF", "VSDP Selection"), Grid.Column(, "VSDP Form Received", format:=@@@Html.TextBox("XXX", item.VSDP_FORM_RCV_DATE, New With {.class = "form-control", .Style = "width:120px;", .disabled = True})), Grid.Column(, "Action", format:=@@
, style:="columnwidth")))




Help with updating a record using controller and service.contracrs

2017-07-21T19:58:34.837-07:00

Please help with me updating a record by passing data directly to the service contract interface.

Current code in controller
Using ( DatabaseConn _dbase = new DatabaseConn())
{
DatabaseTableName _update = DatabaseConn.TableName.Find(recordId);

_dbase.field1 = model.field1;
_dbase.fiels2 = model.field2;
_dbase.field3 = model.field3;
_dbase.........;
DatabaseConn.SaveChanges( );

}

I would like to add the above code to a service.contract where My controller passes a row of data to be
updated it the service contract which is a interface class. I will need the steps for the service interface and controller.

Thanks much




How to update value progress bar bootstrap from controller?

2017-07-23T14:26:10.233-07:00

Hi all!

Can you help me "How to update value progress bar bootstrap from controller?"

Thanks for support!

Brgs




data is null when ajax call reaches controller

2017-07-24T22:32:18.167-07:00

Hello,

I'm trying to do an ajax call to my MVC controller but the data is coming through null.

Here is my ajax call:

var projectId = store.get('filterProjectId');
var data = ra.reportConfigPage.ReportJsonParsed;
var equipmentType = $("#EquipmentTypeTextbox").val();
var dataWithToken = ra.AddVerificationTokenToData({
projectID: projectId,
data: data,
equipmentType: equipmentType
});

$.post({
url: "ReportConfig/SubmitData",
data: dataWithToken,
traditional: true
})
.done(function (data)
{
...
})
.fail(function (jqXhr, textStatus, errorThrown)
{
...
});



And here's SubmitData(...):

[ValidateAntiForgeryToken]
[HttpPost]
[ValidateInput(false)]
public JsonResult SubmitData(int projectId, Top3AndReportCard data = null, string equipmentType = null)
{
...
}

data is not null in the Javascript. When it gets to SubmitData(...) however, it is null.

Can anyone see what's wrong? Thanks.




old .net application using Azure IDaaS

2017-07-25T15:07:26.52-07:00

Please help, i want to modify my legacy .net application(not MVC) to call Azure IDaaS for Active Directory validation. I tried Googling, but found only MVC help material.

So if anyone can help!




Javascript error occurs discontinuously

2017-07-25T14:55:54.22-07:00

Hi everyone, I am developing with a Visual Studio 2015 an Asp.Net core MVC project and in one of the razor pages there is the following javascript code: