Search Results

Search found 3677 results on 148 pages for 'cs 79'.

Page 123/148 | < Previous Page | 119 120 121 122 123 124 125 126 127 128 129 130  | Next Page >

  • AJAX UpdatePanel.Visible Property not working with Javascript

    - by Ahmet Altun
    I have code below. I want to hide the update panel by using Javascript (without going to server) when the user clicks Hide button. Although javascript funciton seems to be working fine in debugging, it does not hide! <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" % <script type="text/javascript" language="javascript"> function Show() { document.getElementById("UpdatePanel1").Visible = true; } function Hide() { document.getElementById("UpdatePanel1").Visible = false; } </script> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Button ID="btnShow" runat="server" Text="Show" OnClientClick="Show(); return false;" /> <asp:Button ID="BtnHide" runat="server" Text="Hide" OnClientClick="Hide(); return false;" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <br /> <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine"></asp:TextBox> <br /> <asp:Button ID="btnSubmit" runat="server" Text="Gönder" onclick="btnSubmit_Click" /> <br /> </ContentTemplate> </asp:UpdatePanel> </div> </form>

    Read the article

  • Oddities in Linq-to-SQL generated code related to property change/changing events

    - by Lasse V. Karlsen
    I'm working on creating my own Linq-to-Sql generated classes in order to learn the concepts behind it all. I have some questions, if anyone knows the answer to one or more of these I'd be much obliged. The code below, and thus the questions, are from looking at code generated by creating a .DBML file in the Visual Studio 2010 designer, and inspecting the .Designer.cs file afterwards. 1. Why is INotifyPropertyChanging not passing the property name The event raising method is defined like this: protected virtual void SendPropertyChanging() Why isn't the name of the property that is changing passed to the event here? It is defined to be part of the EventArgs descendant that is passed to the event handler, but the method only passes an empty such value to it. 2. Why are the EntitySet<X> attach/detach methods not raising property changed? For an EntitySet<X> reference, the following two methods are generated: private void attach_EmailAddress1s(EmailAddress1 entity) { this.SendPropertyChanging(); entity.Person1 = this; } private void detach_EmailAddress1s(EmailAddress1 entity) { this.SendPropertyChanging(); entity.Person1 = null; } Why isn't SendPropertyChanged also called here? I'm sure I have more questions later, but for now these will suffice :)

    Read the article

  • How can show data from another form

    - by Michael Quiles
    This is basically a tic tac toe game, and I have another form called Winner.cs when a player wins I want it to call the form (this part works) and then I want it to say xWinner.label =b1.text"" + has won the game!. the part I cant get to work is displaying the text in the winners form label. There's an example of a message box that commented out for reference instead of b1.text using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace MyGame { public class Result1 { static private int[,] Winners = new int[,] { {0,1,2}, {3,4,5}, {6,7,8}, {0,3,6}, {1,4,7}, {2,5,8}, {0,4,8}, {2,4,6}, }; static public bool CheckWinner(Button[] myControls) { bool gameOver = false; for (int i = 0; i < 8; i++) { int a = Winners[i, 0], b = Winners[i, 1], c = Winners[i, 2]; Button b1 = myControls[a], b2 = myControls[b], b3 = myControls[c]; if (b1.Text == "" || b2.Text == "" || b3.Text == "") continue; if (b1.Text == b2.Text && b2.Text == b3.Text) { b1.BackColor = b2.BackColor = b3.BackColor = System.Drawing.Color.LightCoral; b1.Font = b2.Font = b3.Font = new System.Drawing.Font("Microsoft Sans Serif", 32F, System.Drawing.FontStyle.Italic & System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); gameOver = true; Form xWinnerForm = new xWinnerForm(); xWinnerForm.Show(); //MessageBox.Show(b1.Text + " .... Wins the game!", "Game End", MessageBoxButtons.OK); //break; } } return gameOver; } } }

    Read the article

  • auto refresh of div in mvc3 ASP.Net not working

    - by user1493249
    ViewData.cshtml(Partial View) Date Bill Amount PayNow </tr> </thead> <tbody> @{ for (int i = @Model.bill.Count - 1; i >= 0; i--) { <tr> <td width="30%" align="center">@Model.billdate[i]</td> <td width="30%" align="center">@Model.bill[i]</td> <td width="30%" align="center"> <a class="isDone" href="#" data-tododb-itemid="@Model.bill[i]">Paynow</a> </td> </tr> } } </tbody> Index.cshtml(View) $(document).ready(function () { window.setInterval(function () { var url = '@Url.Action("SomeScreen", "Home")'; $('#dynamictabs').load(url) }, 9000); $.ajaxSetup({ cache: false }); }); @Html.Partial("ViewData") HomeController.cs(Controller) public ActionResult Index() { fieldProcessor fp= new fieldProcessor(); return View(fp); } public ActionResult ShowScreen() { return View("ViewData",fp); } Still the same is not working..

    Read the article

  • Windows Phone 7, login screen redirect and a case for .exit?

    - by Jarrette
    I know this has been discussed ad nauseum, but I want to present my case.... 1. My start page in my app is login.xaml. The user logs in, the username and password are authenticated through my WCF service, the username is saved in isolated storage, and then the user is redirected to mainpage.xaml. When a user starts my app, and they already have a saved username in isolated storage, they are redirected to mainpage.xaml If the user hit's "back" hard button from mainpage.xaml, they are redirected to the login screen, which in turn redirects them back to the mainpage.xaml since they already have a saved local username. This is causing my app to fail certification currently since the user cannot hit the "back" button to exit the app from mainpage.xaml. My instinct here is to override the BackKeyPress in mainpage.xaml and exit the app somehow. By reading the other posts, I can see that this method is not available. My second idea was to somehow store a property in the app.xaml.cs page that would tell the app to exit when the login page is loaded and that property is set to true, but that seems a bit hacky as well.... Any ideas here?

    Read the article

  • Page_Load or Page_Init

    - by balexandre
    Let's take a really simple example on using jQuery to ajaxify our page... $.load("getOrders.aspx", {limit: 25}, function(data) { // info as JSON is available in the data variable }); and in the ASP.NET (HTML part) page (only one line) <%@ Page Language="C#" AutoEventWireup="true" CodeFile="getOrders.aspx.cs" Inherits="getOrders" %> and in the ASP.NET (Code Behind) page public partial class getOrders : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string lmt = Request["limit"]; List<Orders> ords = dll.GetOrders(limit); WriteOutput( Newtonsoft.Json.JsonConvert.SerializeObject(ords) ); } private void WriteOutput(string s) { Response.Clear(); Response.Write(s); Response.Flush(); Response.End(); } } my question is Should it be protected void Page_Load(object sender, EventArgs e) or protected void Page_Init(object sender, EventArgs e) So we can save some milliseconds as we don't actually need to process the events for the page, or will Page_Init lack of some sorting of a method by the time it is called? P.S. Currently works fine in both methods, but I just want to understand the ins and outs of choosing one method over the other

    Read the article

  • .net web service annoying issue

    - by JL
    Excuse the title, but it's best I just explain the problem. I have 2 projects in my solution A Class Library A Web Application, which consists of a web service (asmx). the web service has code sitting in the app_code folder, with a file [webservicename].cs Inside the webservice code behind class, I have a web method here is a sample example (its simplified): [WebMethod] public EnumTaskExportState ProcessTask() { var tm = new UploadTaskManager(); return tm.ProcessTask(); } Now at design time, in visual studio (2010 or 2008), when I right click on UploadTaskMananger, and then select "Go to definition". I get taken to AppData\Temp[some folder structure]...etc.... and it displays the public class definition. Instead I would like to have complete integration, so that I get taken directly to the actual class in the class library project. My guess is, this is happening because I am using the app_code route, and not a compiled file for the web service class. But I don't know any other way to do this. How can I fix this? Possibly do away with the need for the app_code directory?

    Read the article

  • How to get attribute value using SelectSingleNode in C#?

    - by Nano HE
    Hello. I am parsing a xml document, I need find out the gid (an attribute) value (3810). Based on SelectSingleNode(). I found it is not easy to find the attribute name and it's value. Can I use this method or I must switch to other way. Attached my code. How can I use book obj to get the attribute value3810 for gid. Thank you. My test.xml file as below <?xml version="1.0"?> <root> <VersionInfo date="2007-11-28" version="1.0.0.2"/> <Attributes> <AttrDir name="EFEM" DirID="1"> <AttrDir name="Aligner" DirID="2"> <AttrDir name="SequenceID" DirID="3"> <AttrObj text="Slot01" gid="3810" unit="" scale="1"/> <AttrObjCount value="1"/> </AttrDir> </AttrDir> </AttrDir> </Attributes> </root> I wrote the test.cs as below public class Sample { public static void Main() { XmlDocument doc = new XmlDocument(); doc.Load("test.xml"); XmlNode book; XmlNode root = doc.DocumentElement; book = root.SelectSingleNode("Attributes[AttrDir[@name='EFEM']/AttrDir[@name='Aligner']/AttrDir[@name='SequenceID']/AttrObj[@text='Slot01']]"); Console.WriteLine("Display the modified XML document...."); doc.Save(Console.Out); } }

    Read the article

  • Panel in Windows Forms Application not clearing

    - by SwiftStriker00
    I'm working on my project: [Beer Pong Management System][1], a Windows Forms application. I am currently trying to add a whole tournament mode to it. In a nutshell, I've created a TabControl, with the first tab page with the settings and setup and the second page the brackets. There is a feature for each of the match-ups, that once there is a winner is decided, a yellow cancel button will appear in order to revert the tournament. However my issue is when i click the button the next match-up does not get removed in the series is going. See below: Image Here(not high enough rep to insert image) I have tried to set the MatchUp to null, I've tried dispose(), close(). even Parent.Controls.Remove(). Even after I switch tabs which is supposed to clear all, they still sit there when i come back. I have a feeling I might be loosing a reference or something because I can't even push new teams into them, they just sit there with their buttons. Does anyone have any tips or know of any known issues that might be causing this? Thanks. [1] _http://www.cs.rit.edu/~rmb1201/pages/code.shtml

    Read the article

  • The Purpose of a Service Layer and ASP.NET MVC 2

    - by user332022
    In an effort to understand MVC 2 and attempt to get my company to adopt it as a viable platform for future development, I have been doing a lot of reading lately. Having worked with ASP.NET pretty exclusively for the past few years, I had some catching up to do. Currently, I understand the repository pattern, models, controllers, data annotations, etc. But there is one thing that is keeping me from completely understanding enough to start work on a reference application. The first is the Service Layer Pattern. I have read many blog posts and questions here on Stack Overflow, but I still don't completely understand the purpose of this pattern. I watched the entire video series at MVCCentral on the Golf Tracker Application and also looked at the demo code he posted and it looks to me like the service layer is just another wrapper around the repository pattern that doesn't perform any work at all. I also read this post: http://www.asp.net/Learn/mvc/tutorial-38-cs.aspx and it seemed to somewhat answer my question, however, if you are using data annotations to perform your validation, this seems unnecessary. I have looked for demonstrations, posts, etc. but I can't seem to find anything that simply explains the pattern and gives me compelling evidence to use it. Can someone please provide me with a 2nd grade (ok, maybe 5th grade) reason to use this pattern, what I would lose if I don't, and what I gain if I do?a

    Read the article

  • Is there a better way to do updates in LinqToSQL?

    - by Vaccano
    I have a list (that comes to my middleware app from the client) that I need to put in my database. Some items in the list may already be in the db (just need an update). Others are new inserts. This turns out to be much harder than I thought I would be. Here is my code to do that. I am hoping there is a better way: public void InsertClients(List<Client> clients) { var comparer = new LambdaComparer<Client>((x, y) => x.Id == y.Id); // Get a listing of all the ones we will be updating var alreadyInDB = ctx.Clients .Where(client => clients.Contains(client, comparer)); // Update the changes for those already in the db foreach (Client clientDB in alreadyInDB) { var clientDBClosure = clientDB; Client clientParam = clients.Find(x => x.Id == clientDBClosure.Id); clientDB.ArrivalTime = clientParam.ArrivalTime; clientDB.ClientId = clientParam.ClientId; clientDB.ClientName = clientParam.ClientName; clientDB.ClientEventTime = clientParam.ClientEventTime; clientDB.EmployeeCount = clientParam.EmployeeCount; clientDB.ManagerId = clientParam.ManagerId; } // Get a list of all clients that are not in my the database. var notInDB = clients.Where(x => alreadyInDB.Contains(x, comparer) == false); ctx.Clients.InsertAllOnSubmit(notInDB); ctx.SubmitChanges(); } This seems like a lot of work to do a simple update. But maybe I am just spoiled. Anyway, if there is a easier way to do this please let me know. Note: If you are curious the code to the LambdaComparer is here: http://gist.github.com/335780#file_lambda_comparer.cs

    Read the article

  • C# Timer -- measuring time slower

    - by Fassenkugel
    I'm writing a code where: I.) The user adds "events" during run-time. (To a flowlayoutpanel) These events are turning some LEDs on/off, after "x" time has elapsed and the LED-turning functions are written in a Led-function.cs class. i.e: 1) Turn left led on After 3500ms 2) Turn right led on After 4000ms II.) When the user hits start a timer starts. // Create timer. System.Timers.Timer _timer; _timer = new System.Timers.Timer(); _timer.Interval = (1); _timer.Elapsed += (sender, e) => { HandleTimerElapsed(LedObject, device, _timer); }; _timer.Start(); III.) The timer's tick event is raised every millisecond and checks if the user definied time has ellapsed. Im measuring the elapsed time with adding +1 to an integer at every tick event. (NumberOfTicks++;) //Timer Handle private void HandleTimerElapsed(Led_Functions LedObject, string device, System.Timers.Timer _timer) { NumberOfTicks++; if (NumberOfTicks >= Start_time[0]) { LedObject.LeftLED_ONnobutton(device); } } IV.) What I noticed was that when the tick was set to 1. (So the tick event is raised every millisecond) Even if I set 3000ms to the evet the LED actually flashed around 6 seconds. When the tick was set to 100. (So every 0,1s) then the flash was more accurate (3,5sec or so). Any Ideas why im having this delay in time? Or do you have any ideas how could I implement it better? Thank you!

    Read the article

  • How to have table span the entire height?

    - by Yogendra
    Hi All, I have a html table and I am trying to have it span the entire page height. For some reason I am not able to get this to work. I have set the html, body and table height to be 100%, but the table still does not occupy the entire 100%. Heres the code. It is very basic because I am just trying to have the table occupy the entire height. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %> <style type="text/css"> body,html { margin:0; padding:0; height:100%; } </style> <table border="2" cellpadding="0" cellspacing="0" style="height:100%; width:100%" > <tr> <td>ABCD</td> </tr> </table> </form> I tried for couple of hours and I could not get it to work. Any help is really appreciated.

    Read the article

  • IE7 & IE8 error executing function with ajax

    - by Yahreen
    I am loading an ajax page which executes an HTML5 video player script. The function for the Flash fallback is html5media(); : //Load 1st Case Study $("#splash").live('click', function (e) { $(this).fadeOut('slow', function () { $('#case-studies').load('case-study-1.html', function() { html5media(); //initiate Flash fallback }).fadeIn(); }); e.preventDefault(); }); This initial page load works fine in IE7 & IE8. The problem is once this page is loaded, there are links to 4 more videos which are loaded in again using ajax. I use this function: //Switcher function csClients(url, client) { $("#case-studies").fadeOut('slow', function() { $('#case-studies').load(url, function () { html5media(); //initiate Flash fallback }).fadeIn(); }); } //Page Loader $("#cs-client-list li.client1 a").live('click', function(e) { csClients('case-study-1.html', 'client1'); e.preventDefault(); }); Originally I was using return false; but none of the sub-page Flash videos would load in IE7. When I switched to preventDefault, the videos loaded in IE7 but still not in IE8. I also get a weird error in both IE7 & IE8 with no helpful feedback: Error on Page: Unspecified error. / (Line 49) Code: 0 (Char 5) URI: http://www.mysite.com This is line 49 in my index page: <section id="case-studies" class="main-section"> I have a feeling it has to do with calling html5media(); too many times? At a loss...

    Read the article

  • Add Source file link to the default ASP.NET Server Error page?

    - by Max Schilling
    Has anyone ever thought to attempt to modify the default ASP.NET Server error page to provide a link BACK to the error source in Visual Studio? Consider the following standard error page in ASP.NET: Server Error in '/myproject' Application. Invalid object name 'usp_DoSomething'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'usp_DoSomething'. Source Error: Line 4323: cmd.CommandText = "usp_DoSomething"; Line 4324: Line 4325: using (var dr = cmd.ExecuteReader()) Line 4326: { Line 4327: if (dr != null) Source File: c:\development\myproject\myproject.components\providers\sql\sqldataprovider.cs Line: 4325 When an error like this is generated, the HTML has the source back to the file the error occurs in and the line number. Has anyone ever written or thought of writing some mechanism to turn the text into a link back to the error in Visual Studio? I've never seen anything that does it, but it just seems like it would be a helluva nice feature and I think about it in the back of my mind every time an error occurs when I have to manually go find it in the source. It would just be nice to be able to click a link to take me straight there. Anyone written any, or know of any solutions for this. I use Chrome or Firefox as my browsers of choice, but I'd even consider using IE again if someone found a plugin that did this. Thanks, Max

    Read the article

  • What is better for a student programming in C++ to learn for writing GUI: C# vs QT?

    - by flashnik
    I'm a teacher(instructor) of CS in the university. The course is based on Cormen and Knuth and students program algorithms in C++. But sometimes it is good to show how an algorithm works or just a result of task through GUI. Also in my opinion it's very imporant to be able to write full programs. They will have courses concerning GUI but a three years, later, in fact, before graduatuion. I think that they should be able to write simple GUI applications earlier. So I want to teach them it. How do you think, what is more useful for them to learn: programming GUI with QT or writing GUI in C# and calling unmanaged C++ library? Update. For developing C++ applications students use MS Visual studio, so C# is already installed. But QT AFAIK also can be integrated into VS. I have following pros of C# (some were suggested there in answers): The need to make an additional layer. It's more work, but it forces you explicitly specify contract between GUI and processing data. The border between GUI and algorithms becomes very clear. It's more popular among employers. At least, in Russia where we live. It's rather common to write performance-critical algorithms in C++ and PInvoke them from well-looking C# application/ASP.Net website. Maybe it is not so widespread in the rest of the world but in Russia Windows is very popular, especially in companies and corporations due to some reasons, so most of b2b applications are Windows applications. Rapid development. It's much quicker to code in .Net then in C++ due to many reasons. And the con is that it's a new language with own specific for students. And the mess with invoking calls to library.

    Read the article

  • when i create user it aoutomaticaly logged in to newly created user how can i prevent it?

    - by kalyani
    heloo public partial class CreateUser : System.Web.UI.Page { TextBox username; protected void Page_Load(object sender, EventArgs e) { Class1.OpenConn(); string[] rolesArray; if(!(IsPostBack)) { rolesArray = Roles.GetAllRoles(); rdButtonListRoles.DataSource = rolesArray; rdButtonListRoles.DataBind(); } if(IsPostBack) { Class1 cs = new Class1(); username = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName"); ProfileCommon newProf; newProf = Profile.GetProfile(username.Text); TextBox MobileNo, name, Sirname; name = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtname"); Sirname = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtSirname"); MobileNo = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("MobileNo"); newProf.Name = name.Text; newProf.Sirname = Sirname.Text; newProf.MobileNo = MobileNo.Text; newProf.Save(); RoleDiv.Visible = false; } } protected void ContinueButton_Click(object sender, EventArgs e) { for (int i = 0; i < rdButtonListRoles.Items.Count; i++) { if (rdButtonListRoles.Items[i].Selected == true) { if (!Roles.IsUserInRole(username.Text, rdButtonListRoles.Items[i].Text)) { Roles.AddUserToRole(username.Text, rdButtonListRoles.Items[i].Text.ToString()); } } else { if (Roles.IsUserInRole(username.Text, rdButtonListRoles.Items[i].Text)) { Roles.RemoveUserFromRole(username.Text, rdButtonListRoles.Items[i].Text.ToString()); } } } Response.Redirect("ManageUser.aspx"); } protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { } } plz give me the solution help me

    Read the article

  • How to determine if the camera button is half pressed

    - by Matthew
    I am creating a small test camera application, and I would like to be able to implement a feature that allows focus text bars to be present on the screen while the hardware camera button is pressed half way down. I created a camera_ButtonHalfPress event to perform the focus action, but I am unsure of how to toggle the text bars I would like to show on the screen accordingly. Essentially, my goal would be to show the text bars while the camera button is pressed half way down, and then remove them if the button is pressed all the way or the button is released before being pressed all the way down. The button being released is the part I am having trouble with. What I have is as follows: MainPage.xaml.cs private void camera_ButtonHalfPress(object sender, EventArgs e) { //camera.Focus(); // Show the focus brackets. focusBrackets.Visibility = Visibility.Visible; } } private void camera_ButtonFullPress(object sender, EventArgs e) { // Hide the focus brackets. focusBrackets.Visibility = Visibility.Collapsed; camera.CaptureImage(); } } Currently, if the the user decides to release the camera button before it is pressed all the way, the focus brackets persist on the screen. How might I fix this issue?

    Read the article

  • Getting information from servlet created html

    - by user541597
    I have a servlet that creates an html text box and then redirects to another servlet on submit. How can I access the value of the html text box from the new servlet? I am able to access servlet variables from the new servlet but I am not aware of how to access the value of the html generated code. thanks, Here is the servlet that gets the text input public class ServletB extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); String value = System.getProperty("card"); PrintWriter out = response.getWriter(); out.println("<center><h1>Your preffered method of payment is "+value+"</h1><br />"); out.println("Please Enter Card Number<input type =\"text\" name = \"number\"/><form action=\"http://codd.cs.gsu.edu:9999/cpereyra183/servlet/ServletC\"><input type =\"submit\" value=\"Continue\" /><input type=\"button\" value=\"Cancel\" /></center>"); } }} This is the servlet the first servlet redirects to all I do is try to do is output the text input public class ServletC extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); String value = System.getProperty("card"); PrintWriter out = response.getWriter(); out.println(request.getParameter("number")); } }

    Read the article

  • Silverlight 4 caching issue?

    - by DavidS
    I am currently experiencing a weird caching problem it would seem. When I load my data intially, I return all the data within given dates and my graph looks as follows: Then I filter the data to return a subset of the original data for the same date range (not that it matters) and I get the following view of my data: However, I intermittently get the following when I refresh the same filterd view of the data: One can see that not all the data gets cached but only some of it i.e. for 12 Dec 2010 and 5 dec 2010(not shown here). I've looked at my queries and the correct data is getting pulled out. It is only on the presentation layer i.e. on Mainpage.xaml.cs that this erroneous data seems to exist. I've stepped through the code and the data is corect through all the layers except on the presentation layer. Has anyone experienced this before? Is there some sort of caching going in the background that is keeping that data in the background as I've got browser caching off? I am using the LoadOperation in the callback method within the Load method of the DomainContext if that helps...

    Read the article

  • onKeypress Enter Key event on textfield not working in Chrome

    - by rlcrews
    I have a question along the same vein as the one asked here regarding how the enter key is handled in chrome. The effect I am trying to accomplish is to allow the enter key to call a click event of one a button while focus in within the current field. To accomplish this I am using the following code: javascript: <script type="text/javascript"> //attempting to capture keypress for chrome here but this is not working $("#txtContainer").keypress(function (e) { if (e.keyCode == '13') { e.preventDefault(); doClick(buttonname, e); return false; } }); function doClick(buttonName, e) { var key; if (window.event) key = window.event.keyCode; //IE else key = e.which; //firefox if (key == 13) { var btn = document.getElementById(buttonName); if (btn != null) { btn.click(); event.keyCode = 0 } } } </script> within the aspx <form id="form1" runat="server"> <div> <asp:LinkButton ID="newBtn" runat="server" OnClick="btnLogin_Click" Text="ASP Link" /> <asp:TextBox ID="txtContainer" runat="server" Width="100" /> <asp:Label ID="time_lbl" runat="server" /> </div> </form> and within the code behind aspx.cs protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { txtContainer.Attributes.Add("onKeyPress", "doClick('" + newBtn.ClientID + "',event)"); } } public void btnLogin_Click(object sender, EventArgs e) { time_lbl.Text = txtContainer.Text; } The above code works fine in FF and IE however chrome continues to submit the entire form vs. capturing the keypress on the enterkey. Thank you for any suggestions.

    Read the article

  • What is a better, cleaner way of using List<T>

    - by Tim Meers
    I'm looking to implement a few nicer ways to use List in a couple of apps I'm working on. My current implementation looks like this. MyPage.aspx.cs protected void Page_Load(object sender, EventArgs e) { BLL.PostCollection oPost = new BLL.PostCollection(); oPost.OpenRecent(); rptPosts.DataSource = oArt; rptPosts.DataBind(); } BLL Class(s) public class Post { public int PostId { get; set; } public string PostTitle { get; set; } public string PostContent { get; set; } public string PostCreatedDate { get; set; } public void OpenRecentInitFromRow(DataRow row) { this.PostId = (int) row["id"]; this.PostTitle = (string) row["title"]; this.PostContent = (string) row["content"]; this.PostCreatedDate = (DateTime) row["createddate"]; } } public class PostCollection : List<Post> { public void OpenRecent() { DataSet ds = DbProvider.Instance().Post_ListRecent(); foreach (DataRow row in ds.Tables[0].Rows) { Post oPost = new Post(); oPost.OpenRecentInitFromRow(row); Add(oPost); } } } Now while this is working all well and good, I'm just wondering if there is any way to improve it, and just make it cleaner that having to use the two different classes do to something I think can happen in just one class or using an interface.

    Read the article

  • Handling exceptions in Prism 4 modules

    - by marcellscarlett
    I've gone through a number of threads here about this topic with no success. It seems that in the App.xaml.cs of our WPF application, handling DispatcherUnhandledExceptions and AppDomain.CurrentDomain.UnhandledException don't catch everything. In this specific instance we have 7 prism modules. My exception handling code is below (almost identical for UnhandledException): private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { try { var ex = e.Exception.InnerException ?? e.Exception; var logManager = new LogManager(); logManager.Error(ex); if (!EventLog.SourceExists(ex.Source)) EventLog.CreateEventSource(ex.Source, "AppName"); EventLog.WriteEntry(ex.Source, ex.InnerException.ToString()); var emb = new ExceptionMessageBox(ex); emb.ShowDialog(); e.Handled = true; } catch (Exception) { } } The problem seems to be the unhandled exceptions occurring in the modules. They aren't caught by the code above and they cause the application to crash without logging or displaying any sort of message. Does anyone have experience with this?

    Read the article

  • How to do a Translate Animation for both axis(X, Y) at the same time?

    - by user1235555
    I am doing something like this in my Storyboard method but not able to achieve the desired result. This animation I want to be played after the page is loaded. private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { CreateTranslateAnimation(image1); } private void CreateTranslateAnimation(UIElement source) { Storyboard sb = new Storyboard(); DoubleAnimationUsingKeyFrames animationFirstX = new DoubleAnimationUsingKeyFrames(); source.RenderTransform = new CompositeTransform(); Storyboard.SetTargetProperty(animationFirstX, new PropertyPath(CompositeTransform.TranslateXProperty)); Storyboard.SetTarget(animationFirstX, source.RenderTransform); animationFirstX.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = kt1, Value = 20 }); DoubleAnimationUsingKeyFrames animationFirstY = new DoubleAnimationUsingKeyFrames(); source.RenderTransform = new CompositeTransform(); Storyboard.SetTargetProperty(animationFirstY, new PropertyPath(CompositeTransform.TranslateYProperty)); Storyboard.SetTarget(animationFirstY, source.RenderTransform); animationFirstY.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = kt1, Value = 30 }); sb.Children.Add(animationFirstX); sb.Children.Add(animationFirstY); sb.Begin(); } Too cut it short... I want to write .cs code equivalent to this code <Storyboard x:Name="Storyboard1"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="image1"> <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="20"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="image1"> <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="30"/> </DoubleAnimationUsingKeyFrames> </Storyboard>

    Read the article

  • Quantifying the Performance of Garbage Collection vs. Explicit Memory Management

    - by EmbeddedProg
    I found this article here: Quantifying the Performance of Garbage Collection vs. Explicit Memory Management http://www.cs.umass.edu/~emery/pubs/gcvsmalloc.pdf In the conclusion section, it reads: Comparing runtime, space consumption, and virtual memory footprints over a range of benchmarks, we show that the runtime performance of the best-performing garbage collector is competitive with explicit memory management when given enough memory. In particular, when garbage collection has five times as much memory as required, its runtime performance matches or slightly exceeds that of explicit memory management. However, garbage collection’s performance degrades substantially when it must use smaller heaps. With three times as much memory, it runs 17% slower on average, and with twice as much memory, it runs 70% slower. Garbage collection also is more susceptible to paging when physical memory is scarce. In such conditions, all of the garbage collectors we examine here suffer order-of-magnitude performance penalties relative to explicit memory management. So, if my understanding is correct: if I have an app written in native C++ requiring 100 MB of memory, to achieve the same performance with a "managed" (i.e. garbage collector based) language (e.g. Java, C#), the app should require 5*100 MB = 500 MB? (And with 2*100 MB = 200 MB, the managed app would run 70% slower than the native app?) Do you know if current (i.e. latest Java VM's and .NET 4.0's) garbage collectors suffer the same problems described in the aforementioned article? Has the performance of modern garbage collectors improved? Thanks.

    Read the article

< Previous Page | 119 120 121 122 123 124 125 126 127 128 129 130  | Next Page >