Search Results

Search found 53356 results on 2135 pages for 'net j2ee interoperabilit'.

Page 115/2135 | < Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >

  • VB.NET textbox changed but still hold initial value

    - by Jonesy
    Hi Folks, I've never come across this before: I have a series of text boxes. The text of these boxes get set on page load. then I have a submit button that calls a sub to update the table with the new values (text) in the text box. The problem is it is keeping the original text not the text that is CURRENTLY in the textbox. Anyone come across this before? Or know how to get round it? Cheers, Jonesy

    Read the article

  • set current user in asp.net mvc

    - by Tomh
    Hey guys, I'm not sure if this is the best way to do it, but I want to keep a user object alive during all requests of the current user. From reading several resources I learned that you should create your own IPrinciple which holds this. But I don't want to trigger the database every authentication request. Any recommendations on how to handle this? Is caching the db request a good idea? protected void Application_AuthenticateRequest(Object sender, EventArgs e) { HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value); User user; using (HgDataContext hg = new HgDataContext()) { if (Session["user"] != null) { user = (from u in hg.Users where u.EmailAddress == authTicket.Name select u).Single(); } else { user = Session["user"] as User; } } var principal = new HgPrincipal(user); Context.User = principal; } }

    Read the article

  • Checking a set of listbox items against a text box vb.net

    - by Shane Fagan
    Hi all I have this code to check if an item from a textbox is in a listbox and its giving me the error at the bottom. Any ideas what im doing wrong? I copied it from another part of my project and it was working for that part so I cant see whats wrong. If LocationsSearchTextBox.Text <> "" And LocationListBox.Items.Count > 0 Then tempInt = 0 While (tempInt < ClientListBox.Items.Count) If LocationListBox.Items(tempInt).ToString.Contains(LocationsSearchTextBox.Text) = False Then LocationListBox.Items.RemoveAt(tempInt) End If tempInt += 1 End While End If System.ArgumentOutOfRangeException was unhandled Message="InvalidArgument=Value of '2' is not valid for 'index'. Parameter name: index" ParamName="index" Source="System.Windows.Forms" StackTrace: at System.Windows.Forms.ListBox.ObjectCollection.get_Item(Int32 index) at AuctioneerProject.Viewing.LocationsSearchTextBox_KeyPress(Object sender, KeyPressEventArgs e) in C:\Users\admin\Desktop\Auctioneers\AuctioneerProject\AuctioneerProject\Viewing.vb:line 301 at System.Windows.Forms.Control.OnKeyPress(KeyPressEventArgs e) at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m) at System.Windows.Forms.Control.ProcessKeyMessage(Message& m) at System.Windows.Forms.Control.WmKeyChar(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.TextBoxBase.WndProc(Message& m) at System.Windows.Forms.TextBox.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at AuctioneerProject.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:

    Read the article

  • ASP.Net ViewState doesn't work when Control become Enable=False

    - by Daok
    Why when a control does contain value but it's set to .Enable=False that all controls become disable (that's ok) but why that the ViewState doesn't retain the data on the next post back? If I get the UserControl without modifing its Enable state, the ViewState work between post back. How can we disable a UserControl that all its control become disable (this part work) but all of them KEEP use the ViewState (this doesn't work)?

    Read the article

  • ASP.NET MVC AJAX value not displaying

    - by mazhar kaunain baig
    View: function success(arg) { var obj = arg.get_response().get_object(); if (obj.ErrorMessage === '') { var answer = document.createElement('div'); answer.appendChild(document.createTextNode(obj.Answer)); document.getElementById('answers').appendChild(answer); } else { document.getElementById('errors').innerHTML = obj.ErrorMessage; } } <% using (Ajax.BeginForm("EditOrganizationMeta", "Organization", new AjaxOptions { HttpMethod = "POST", OnSuccess = "success" })) { %> <input type="submit" name="button<%=OrganizationMeta.vcr_MetaKey + Lang.int_LangId %>" value="Save" /> <div id="errors"></div> <div id="answers"></div> <% } %> Controller: [HttpPost] [ValidateInput(false)] public ActionResult EditOrganizationMeta(FormCollection collection) { return Json(new { Answer = "Record Successfully Saved", ErrorMessages = "Title is required" }); } The thing is that success method in the javascript is not getting the required parameters. It is printing undefined there. Is there a problem in javascript method OnSuccess?

    Read the article

  • Invoke an action that is using ASP.NET MVC [Authorize] from outside the application

    - by Nate Bross
    Is this possible? I'd like to expose a URL (action) such as http://mysever/myapp/UpdateHeartbeat/. In my MVC application it looks like [Authorize] [AcceptsVerbs(HttpVerbs.Post)] public ActionResult UpdateHeartbeat() { // update date in DB to DateTime.Now } Now, in my MVC application the user has logged in via FORMS authentication and they can execute that action to their hearts content. What I want to do, is hit that URL progromatically (as part of an API that I wouldl like to build) -- is there a way I can do that without removing the [Authorize] attribute and adding username/password as parameters to the POST?

    Read the article

  • Asp.Net MVC2 Model Binding Problem.

    - by Pino
    Why is my controller recieving an empty model in this case? Using the following, <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<X.Models.ProductModel>" %> <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server"> <h2>Product</h2> <% using (Html.BeginForm() {%> <%: Html.ValidationSummary(true) %> <div class="editor-label"> Product Name </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.Name) %> <%: Html.ValidationMessageFor(model => model.Name) %> </div> <br /> <div class="editor-label"> Short Description </div> <div class="editor-field"> <%: Html.TextAreaFor(model => model.ShortDesc) %> <%: Html.ValidationMessageFor(model => model.ShortDesc) %> </div> <br /> <div class="editor-label"> Long Description </div> <div class="editor-field"> <%: Html.TextAreaFor(model => model.LongDesc) %> <%: Html.ValidationMessageFor(model => model.LongDesc) %> </div> <p> <input type="submit" value="Create" /> </p> <% } %> </asp:Content> and the following controller using System.Web.Mvc; using X.Lib.Services; using X.Models; namespace X.Admin.Controllers { public class ProductController : Controller { [HttpGet] public ActionResult ProductData() { return View(); } [HttpPost] public ActionResult ProductData(ProductModel NewProduct) { //Validate and save if(ModelState.IsValid) { //Save And do stuff. var ProductServ = new ProductService(); ProductServ.AddProduct(NewProduct); } return View(); } } }

    Read the article

  • ASP.NET custom server control: nested items

    - by Dylan Lin
    Hi, In the aspx code view, we can code like this: <asp:ListBox runat="server"> <asp:ListItem Text="Item1" /> <asp:ListItem Text="Item2" /> </asp:ListBox> However, the ListItem class is not a server control. How could we do that? Is there some attributes being consumed by the visual studio? Thanks:)

    Read the article

  • Using the Callback Method on a View in ASP.NET MVC

    - by Tony
    I have a master page with that code: public string CallbackMethod; protected void Page_Load(object sender, EventArgs e) { CallbackMethod = Page.ClientScript.GetCallbackEventReference(this, "message", "Dodanie", "context", true); } /other code here/ then, in the View (which is based on that master page) I need to invoke the CallbackMethod string, but the problem is, the framework firstly renders the View, and then invokes the Page_Load method. As the obvious result, the error appears: the name 'CallbackMethod' does not exist in the current context. How do I fix this?

    Read the article

  • Simple ASP.NET Database Query

    - by Steven
    I have loaded my database with one table under "Data Connections" in the "Server Explorer" pane. What is the standard / best-practices way to handle a simple query in a VB ASPX page? My left <div> would be a set of form elements to filter rows, and when the button is clicked, the main <div> would show the columns I want for the rows returned. Note: Answers in C# are okay too, I'll just translate.

    Read the article

  • ASP.NET MVC form GET passing array

    - by creativeincode
    I have a form with a collection of checkbox's for a refine search function on my website. I am trying to pass an array in a form GET but the URL looks like: /search?filter=foo&filter=bar&filter=green Is there a better way to pass this in MVC? Possible like /search?filter=foo,bar,green Thanks in advance.

    Read the article

  • Export database data to csv from view by date range asp.net mvc3

    - by Benjamin Randal
    I am trying to find a way to export data from my database and save it as a .csv file. Ideally the user will be able to select a date range on a view, which will display the data to be exported, then the user can click an "export to CSV" link. I've done quite a bit of searching and but have not found much specific enough to help me step through the process. Any help would be great. I would like to export data from this database model... { public class InspectionInfo { [Key] public int InspectionId { get; set; } [DisplayName("Date Submitted")] [DataType(DataType.Date)] // [Required] public DateTime Submitted { get; set; } [DataType(DataType.MultilineText)] [MaxLength(1000)] // [Required] public string Comments { get; set; } // [Required] public Contact Contact { get; set; } [ForeignKey("Contact")] public Int32 ContactId { get; set; } [MaxLength(100)] public String OtherContact { get; set; } I have a service for search also, just having difficulty implementing public SearchResults SearchInspections(SearchRequest request) { using (var db = new InspectionEntities()) { var results = db.InspectionInfos .Where( i=> ( (null == request.StartDate || i.Submitted >= request.StartDate.Value) && (null == request.EndDate || i.Submitted <= request.EndDate.Value) ) ) .OrderBy(i=>i.Submitted) .Skip(request.PageSize*request.PageIndex).Take(request.PageSize); return new SearchResults{ TotalResults=results.Count(), PageIndex=request.PageIndex, Inspections=results.ToList(), SearchRequest=request }; } }

    Read the article

  • ASP.Net MVC elegant UI and ModelBinder authorization

    - by SDReyes
    We know authorization stuff is a cross cutting concern, and we do anything we could to avoid merge business logic in our views. But I still not found an elegant way to filter UI components (e.g. widgets, form elements, tables, etc) using the current user roles without contaminate the view with business logic. same applies for model binding. Example Form: Product Creation Fields: Name Price Discount Roles: Role Administrator Is allowed to see and modify the Name field Is allowed to see and modify the Price field Is allowed to see and modify the Discount Role Administrator assistant Is allowed to see and modify the Name Is allowed to see and modify the Price Fields shown in each role are different, and model binding needs to ignore the discount field for 'Administrator assistant' role. How would you do it?

    Read the article

  • Help understanding .NET delegates, events, and eventhandlers

    - by Seth Spearman
    Hello, In the last couple of days I asked a couple of questions about delegates HERE and HERE. I confess...I don't really understand delegates. And I REALLY REALLY REALLY want to understand and master them. (I can define them--type safe function pointers--but since I have little experience with C type languages it is not really helpful.) Can anyone recommend some online resource(s) that will explain delegates in a way that presumes nothing? This is one of those moments where I suspect that VB actually handicaps me because it does some wiring for me behind the scenes. The ideal resource would just explain what delegates are, without reference to anything else like (events and eventhandlers), would show me how all everything is wired up, explain (as I just learned) that delegates are types and what makes them unique as a type (perhaps using a little ildasm magic)). That foundation would then expand to explain how delegates are related to events and eventhandlers which would need a pretty good explanation in there own right. Finally this resource could tie it all together using real examples and explain what wiring DOES happen automatically by the compiler, how to use them, etc. And, oh yeah, when you should and should not use delegates, in other words, downsides and alternatives to using delegates. What say ye? Can any of you point me to resource(s) that can help me begin my journey to mastery? EDIT One last thing. The ideal resource will explain how you can and cannot use delegates in an interface declaration. That is something that really tripped me up. Thanks for your help. Seth

    Read the article

  • Need help with auto-scaffolding template in ASP.NET MVC

    - by DanM
    I'm trying to write an auto-scaffolder for Index views. I'd like to be able to pass in a collection of models or view-models (e.g., IQueryable<MyViewModel>) and get back an HTML table that uses the DisplayName attribute for the headings (th elements) and Html.Display(propertyName) for the cells (td elements). Each row should correspond to one item in the collection. Here's what I have so far: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% var items = (IQueryable<TestProj.ViewModels.TestViewModel>)Model; // Should be generic! var properties = items.First().GetMetadata().Properties .Where(pm => pm.ShowForDisplay && !ViewData.TemplateInfo.Visited(pm)); %> <table> <tr> <% foreach(var property in properties) { %> <th> <%= property.DisplayName %> </th> <% } %> </tr> <% foreach(var item in items) { %> <tr> <% foreach(var property in properties) { %> <td> <%= Html.Display(property.DisplayName) %> // This doesn't work! </td> <% } %> </tr> <% } %> </table> Two problems with this: I'd like it to be generic. So, I'd like to replace var items = (IQueryable<TestProj.ViewModels.TestViewModel>)Model; with var items = (IQueryable<T>)Model; or something to that effect. The <td> elements are not working because the Html in <%= Html.Display(property.DisplayName) %> contains the model for the view, which is a collection of items, not the item itself. Somehow, I need to obtain an HtmlHelper object whose Model property is the current item, but I'm not sure how to do that. How do I solve these two problems?

    Read the article

  • .NET Programmatically invoke screenclick doesn't work?

    - by ropstah
    I'm trying to programmatically invoke an onclick event however the click is not received/handled. Am I missing something, or is security preventing the click to be executed? I have a forms application which is invisible. Basically I would like to say: DoDoubleClick(wait, x, y) This should raise two click (mousedown+mouseup) events on screen with the specified wait interval. However the click isn't received in a Flash application in Firefox (which is running at that moment). Here's my code: Form: Public Class Form1 Private WithEvents gmh As GlobalMouseHook Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load gmh = New GlobalMouseHook() Me.Visible = false gmh.DoDoubleClick(50, 800, 600) End Sub Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed gmh.Dispose() End Sub Private Sub gmh_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gmh.MouseDown End Sub Private Sub gmh_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gmh.MouseMove End Sub Private Sub gmh_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gmh.MouseUp End Sub End Class GlobalMouseHook class: Friend Class GlobalMouseHook Implements IDisposable Private hhk As IntPtr = IntPtr.Zero Private disposedValue As Boolean = False Public Event MouseDown As MouseEventHandler Public Event MouseUp As MouseEventHandler Public Event MouseMove As MouseEventHandler Public Sub New() Hook() End Sub Private Sub Hook() Dim hInstance As IntPtr = LoadLibrary("User32") hhk = SetWindowsHookEx(WH_MOUSE_LL, AddressOf Me.HookProc, hInstance, 0) End Sub Private Sub Unhook() UnhookWindowsHookEx(hhk) End Sub Public Sub DoDoubleClick(ByVal wait As Integer, ByVal x As Integer, ByVal y As Integer) RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Left, 1, x, y, 0)) RaiseEvent MouseUp(Me, Nothing) System.Threading.Thread.Sleep(wait) RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Left, 1, x, y, 0)) RaiseEvent MouseUp(Me, Nothing) End Sub Private Function HookProc(ByVal nCode As Integer, ByVal wParam As UInteger, ByRef lParam As MSLLHOOKSTRUCT) As Integer If nCode >= 0 Then Select Case wParam Case WM_LBUTTONDOWN RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Left, 0, lParam.pt.x, lParam.pt.y, 0)) Case WM_RBUTTONDOWN RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Right, 0, lParam.pt.x, lParam.pt.y, 0)) Case WM_MBUTTONDOWN RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Middle, 0, lParam.pt.x, lParam.pt.y, 0)) Case WM_LBUTTONUP, WM_RBUTTONUP, WM_MBUTTONUP RaiseEvent MouseUp(Nothing, Nothing) Case WM_MOUSEMOVE RaiseEvent MouseMove(Nothing, Nothing) Case WM_MOUSEWHEEL, WM_MOUSEHWHEEL Case Else Console.WriteLine(wParam) End Select End If Return CallNextHookEx(hhk, nCode, wParam, lParam) End Function Private Structure API_POINT Public x As Integer Public y As Integer End Structure Private Structure MSLLHOOKSTRUCT Public pt As API_POINT Public mouseData As UInteger Public flags As UInteger Public time As UInteger Public dwExtraInfo As IntPtr End Structure Private Const WM_MOUSEWHEEL As UInteger = &H20A Private Const WM_MOUSEHWHEEL As UInteger = &H20E Private Const WM_MOUSEMOVE As UInteger = &H200 Private Const WM_LBUTTONDOWN As UInteger = &H201 Private Const WM_LBUTTONUP As UInteger = &H202 Private Const WM_MBUTTONDOWN As UInteger = &H207 Private Const WM_MBUTTONUP As UInteger = &H208 Private Const WM_RBUTTONDOWN As UInteger = &H204 Private Const WM_RBUTTONUP As UInteger = &H205 Private Const WH_MOUSE_LL As Integer = 14 Private Delegate Function LowLevelMouseHookProc(ByVal nCode As Integer, ByVal wParam As UInteger, ByRef lParam As MSLLHOOKSTRUCT) As Integer Private Declare Auto Function LoadLibrary Lib "kernel32" (ByVal lpFileName As String) As IntPtr Private Declare Auto Function SetWindowsHookEx Lib "user32.dll" (ByVal idHook As Integer, ByVal lpfn As LowLevelMouseHookProc, ByVal hInstance As IntPtr, ByVal dwThreadId As UInteger) As IntPtr Private Declare Function CallNextHookEx Lib "user32" (ByVal hhk As IntPtr, ByVal nCode As Integer, ByVal wParam As UInteger, ByRef lParam As MSLLHOOKSTRUCT) As Integer Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hhk As IntPtr) As Boolean ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) If Not Me.disposedValue Then If disposing Then ' TODO: free other state (managed objects). End If Unhook() End If Me.disposedValue = True End Sub ' This code added by Visual Basic to correctly implement the disposablepattern. Public Sub Dispose() Implements IDisposable.Dispose ' Do not change this code. Put cleanup code in Dispose(ByValdisposing As Boolean) above. Dispose(True) GC.SuppressFinalize(Me) End Sub End Class

    Read the article

  • ASP.NET C# Show buttons in gridview records

    - by vamyip
    Hello, I want to add a column to a gridview which contains button control. I am using ID(integer and primary key) as the 1st column of Gridview. What I want is that when a user clicks the button on any given row of gridview, I want to able to determine the ID of the row to which the clicked button belongs Vam Yip

    Read the article

  • .NET: XDocument missing XDeclaration?

    - by JamesBrownIsDead
    When I write out this to the console, the output is missing the XDeclaration content. What gives? var map = new XDocument( new XDeclaration("1.0", "UTF-8", null), new XElement(SiteMap.Namespace + "urlset") ); Console.Write(map.ToString()); How do I get the XML for map including the <?xml...> declaration?

    Read the article

  • Problem with usercontrol scaling when added at run-time in .Net, WinForms

    - by Jules
    First here's the steps to replicate, then I'll explain what the problem is: (1) Add a usercontrol to a form in the construtor, after the InitializeComponent call. (2) Run the form. (3) Click a button to increase the form font size. All the controls within the usercontrol scale perfectly but the usercontrol itself doesn't. It's width and height are increased by way too much. To correct the problem, the usercontrol must be added before the InitializeComponent call. If it wasn't possible for me to add the usercontrol before InitializeComponent, is there any way for me to correct the scaling?

    Read the article

  • .Net System.Mail.Message adding multiple "To" addresses

    - by Matt Dawdy
    I just hit something I think is inconsistent, and wanted to see if I'm doing something wrong, if I'm an idiot, or... MailMessage msg = new MailMessage(); msg.To.Add("[email protected]"); msg.To.Add("[email protected]"); msg.To.Add("[email protected]"); msg.To.Add("[email protected]"); Really only sends this email to 1 person, the last one. To add multiples I have to do this: msg.To.Add("[email protected],[email protected],[email protected],[email protected]"); I don't get it. I thought I was adding multiple people to the "To" address collection, but what I was doing was replacing it. I think I just realized my error -- to add one item to the collection, use .To.Add(new MailAddress("[email protected]")) If you use just a string, it replaces everything it had in its list. Ugh. I'd consider this a rather large gotcha! Since I answered my own question, but I think this is of value to have in the stackoverflow archive, I'll still ask it. Maybe someone even has an idea of other traps that you can fall into.

    Read the article

< Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >