Search Results

Search found 4334 results on 174 pages for 'sender'.

Page 85/174 | < Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >

  • ASP.NET 3.5 Routing?

    - by Maushu
    I was looking for a way to route http://www.example.com/WebService.asmx to http://www.example.com/service/ using only the ASP.NET 3.5 Routing framework without needing to configure the IIS server. Until now I have done what most tutorials told me, added a reference to the routing assembly, configured stuff in the web.config, added this to the Global.asax: protected void Application_Start(object sender, EventArgs e) { RouteCollection routes = RouteTable.Routes; routes.Add( "WebService", new Route("service/{*Action}", new WebServiceRouteHandler()) ); } ...created this class: public class WebServiceRouteHandler : IRouteHandler { public IHttpHandler GetHttpHandler(RequestContext requestContext) { // What now? } } ...and the problem is right there, I don't know what to do. The tutorials and guides I've read use routing for pages, not webservices. Is this even possible? Ps: The route handler is working, I can visit /service/ and it throws the NotImplementedException I left in the GetHttpHandler method.

    Read the article

  • WPF Error when implementing Login.xaml

    - by LnDCobra
    I am getting the following exception: "Nullable object must have a value" Everything was working when I was using StartupURI="MainWindow.xaml" but I wanted to implement a login screen so I changed this to Startup="Application_Startup" and then created the following method in App.xaml.cs: private void Application_Startup(object sender, StartupEventArgs e) { UpdateAccounts(); bool result = true; ///* LoginWindow login = new LoginWindow(); result = login.ShowDialog().Value; /* */ if (!result) { return; } MainWindow window = new MainWindow(); bool main = window.ShowDialog().Value; } Does anyone have any idea what is going on? Or any suggestions on what is the best practice for implementing login interface.

    Read the article

  • Using PostRequestHandlerExecute, Flush and Close to clean up after a request - why is this bad?

    - by Erwin
    After some requests I need to clean up after the user - by calling a remote web service to release some resources if I guess the user doesn't need them anymore. It is ok to leave them hanging and letting them time out on the other server, but the polite thing to do is to inform it that I do not need them anymore. I do not want to waste the users time waiting for cleaning - so I tried to find place to put it. First I tried Application_EndRequest, but I needed something later. Then I found PostRequestHandlerExecute which seemed like a nice place, but I still need a Flush and Close to release the connection to the user. Protected Sub Application_PostRequestHandlerExecute(ByVal sender As Object, ByVal e As System.EventArgs) Response.Flush() Response.Close() ' Simulation of clean up activity: System.Threading.Thread.Sleep(4000) ' Really a couple of web service calls End Sub Is there some other place I could put these lengthy clean up routines?

    Read the article

  • VB.NET: How to know time for which system is idle?

    - by Daredev
    I'm making an application in which I'm implementing auto-monitor turn off when system is idle, i.e. when user is not interacting with the system. I found a link: http://www.codeproject.com/KB/system/SystemIdleTimerComponent.aspx it does provides the componenent to know when system is idle. But when I include: Public WM_SYSCOMMAND As Integer = &H112 Public SC_MONITORPOWER As Integer = &Hf170 <DllImport("user32.dll")> _ Private Shared Function SendMessage(hWnd As Integer, hMsg As Integer, wParam As Integer, lParam As Integer) As Integer End Function Private Sub button1_Click(sender As Object, e As System.EventArgs) SendMessage(Me.Handle.ToInt32(), WM_SYSCOMMAND, SC_MONITORPOWER, 2) End Sub It shows this error: Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on.

    Read the article

  • GridView_RowsDeleting event doesn't work

    - by iTayb
    I have a datagarid with a onrowdeleting="SellersGridView_RowsDeleting" switch. My method is: protected void SellersGridView_RowsDeleting(object sender, GridViewDeleteEventArgs e) { string seller = ((Label)SellersGridView.Rows[e.RowIndex].Cells[0].FindControl("TextBoxSeller")).Text; BookStore b = new BookStore(); b.LoadFromXML(Server.MapPath("list.xml")); string ISBN = Request.QueryString["ISBN"].ToString(); int ID = b.BooksList.FindIndex(x => x.ISBN == ISBN); Book myBook = b.BooksList[ID]; myBook.RemoveSeller(seller); Response.Redirect("editbook.aspx?ISBN=" + ISBN); } Well, it seems that when I try to delete anything - nothing happens. I tried to change the first line to Response.Redirect("foo") just to check if the event itself is fired, and it turns out that it doesn't. I can't get The reason. Here is my gridview control: http://pastebin.com/CKDAMECT Thank you very much!

    Read the article

  • Problems with sending a multipart/alternative email with PHP

    - by saturdayplace
    Here's the script that's builds/sends the email: $boundary = md5(date('U')); $to = $email; $subject = "My Subject"; $headers = "From: [email protected]" . "\r\n". "X-Mailer: PHP/".phpversion() ."\r\n". "MIME-Version: 1.0" . "\r\n". "Content-Type: multipart/alternative; boundary=--$boundary". "\r\n". "Content-Transfer-Encoding: 7bit". "\r\n"; $text = "You really ought remember the birthdays"; $html = '<html> <head> <title>Birthday Reminders for August</title> </head> <body> <p>Here are the birthdays upcoming in August!</p> <table> <tr> <th>Person</th><th>Day</th><th>Month</th><th>Year</th> </tr> <tr> <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> </tr> <tr> <td>Sally</td><td>17th</td><td>August</td><td>1973</td> </tr> </table> </body> </html> '; $message = "Multipart Message coming up" . "\r\n\r\n". "--".$boundary. "Content-Type: text/plain; charset=\"iso-8859-1\"" . "Content-Transfer-Encoding: 7bit". $text. "--".$boundary. "Content-Type: text/html; charset=\"iso-8859-1\"". "Content-Transfer-Encoding: 7bit". $html. "--".$boundary."--"; mail("[email protected]", $subject, $message, $headers); It sends the message just fine, and my recipient receives it, but they get the whole thing in text/plain instead of in multipart/alternative. Viewing the source of the received message gives this (lots of cruft removed): Delivered-To: [email protected] Received: by 10.90.100.4 with SMTP id x4cs111413agb; Wed, 25 Mar 2009 16:39:32 -0700 (PDT) Received: by 10.100.153.6 with SMTP id a6mr85081ane.123.1238024372342; Wed, 25 Mar 2009 16:39:32 -0700 (PDT) Return-Path: <[email protected]> --- snip --- Date: Wed, 25 Mar 2009 17:37:36 -0600 (MDT) Message-Id: <[email protected]> To: [email protected] Subject: My Subject From: [email protected] X-Mailer: PHP/4.3.9 MIME-Version: 1.0 Content-Type: text/plain; boundary="--66131caf569f63b24f43d529d8973560" Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 25 Mar 2009 23:38:30.0531 (UTC) FILETIME=[CDC4E530:01C9ADA2] X-TM-AS-Product-Ver: SMEX-8.0.0.1181-5.600.1016-16540.005 X-TM-AS-Result: No--4.921300-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Multipart Message coming up --66131caf569f63b24f43d529d8973560 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit You really ought remember the birthdays --66131caf569f63b24f43d529d8973560 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit <html> <head> <title>Birthday Reminders for August</title> </head> <body> <p>Here are the birthdays upcoming in August!</p> <table> <tr> <th>Person</th><th>Day</th><th>Month</th><th>Year</th> </tr> <tr> <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> </tr> <tr> <td>Sally</td><td>17th</td><td>August</td><td>1973</td> </tr> </table> </body> </html> --66131caf569f63b24f43d529d8973560-- It looks like the content-type header is getting changed along the way from multipart/alternative to text/plain. I'm no sysadmin, so if this is a sendmail issue I'm in way over my head. Any suggestions?

    Read the article

  • IEditableCollectionView.AddNew() Throwing ArgumentNullException

    - by Eugarps
    In the context of Silverlight RIA using DomainContext and, the code as follows: private void AddProductButton_Click(object sender, RoutedEventArgs e) { var target = (Web.LocatorProduct)((IEditableCollectionView)ProductSource.DataView).AddNew(); target.Locator = LocatorID; target.Product = NewProduct.Text.ToUpper(); ((IEditableCollectionView)ProductSource.DataView).CommitNew(); } Is throwing ArgumentNullException in AddNew(), CreateIdentity() further up on the stack (a generated method) due to product being null. Product and LocatorID are, in combination, the primary key. I'm guessing that EF is not allowing me to generate a new item without meeting database contraints? How does this make sense if I need to obtain a primary key from the user? I have control over all tiers of the application, so suggestions on database design if needed are also welcomed.

    Read the article

  • mouse wheel scrolling work with f5 in app but don't work on web

    - by lina
    Good day! I have a web application on Silverlight 3. on ManePage I have a <ScrollViewer x:Name="sV" MouseWheel="sV_MouseWheel" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"> with such code: private void sV_MouseWheel(object sender, MouseWheelEventArgs e) { var offset = sV.VerticalOffset; sV.ScrollToVerticalOffset(offset + (e.Delta * -0.5)); } When I press F5 button to debug my application, mouse wheel scrolling works well, but when I press F6 and then choose Web.Project prperty Debug-Start New Instance or publish my project on site, mouse wheel scrolling doesn't work :( what can I do?

    Read the article

  • How to programmatically answer "Yes" to WebBrowser control security alert

    - by ih8ie8
    I am using WebBrowser control to programmatically access a single website, but whenever I login, I receive this certificate security alert: Since I trust that website and since I need to programmatically automate the login as well, this dialog box gets in the way. I searched SO for a solution and found a question similar to mine, but the accepted answer does not work! I defined a static member in the form that contains the WebControl: public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; } In my form's constructor I added: ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateServerCertificate); But that didn't get rid of the certificate security alert. Is there any way to get rid of this warning? Is there an IE equivalent to Firefox's Add Security Exception??? Note: The owner's certificate works perfectly fine (without exhibiting this security alert) with standalone browsers (IE, FF, Chrome, Safari). It only exhibits the problem with the WebBroswer control.

    Read the article

  • .NET sendkeys to calculator

    - by user203123
    The sendkeys code below works well for Notepad but it doesn't work for Calculator. What is the problem? (It's another problem compared to what I sent here http://stackoverflow.com/questions/2604486/c-sendkeys-problem) [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern IntPtr FindWindow(string lpClassName,string lpWindowName); [DllImport("User32")] public static extern bool SetForegroundWindow(IntPtr hWnd); private void button1_Click(object sender, EventArgs e) { IntPtr calculatorHandle = FindWindow("SciCalc", "Calculator"); //IntPtr calculatorHandle = FindWindow("Notepad", "Untitled - Notepad"); if (calculatorHandle == IntPtr.Zero) { MessageBox.Show("Calculator is not running."); return; } SetForegroundWindow(calculatorHandle); System.Threading.Thread.Sleep(1000); SendKeys.SendWait("111*11="); //SendKeys.SendWait("{ENTER}"); //cnt++; SendKeys.Flush(); }

    Read the article

  • Edit dialog, with bindings and OK/Cancel in WPF

    - by Erik
    How can i have a dialog for editing the properties of a class with binding, and have OK-Cancel in the dialog? My first idea was this: public partial class EditServerDialog : Window { private NewsServer _newsServer; public EditServerDialog(NewsServer newsServer) { InitializeComponent(); this.DataContext = (_newsServer = newsServer).Clone(); } private void ButtonClick(object sender, RoutedEventArgs e) { switch (((Button)e.OriginalSource).Content.ToString()) { case "OK": _newsServer = (NewsServer)this.DataContext; this.Close(); break; case "Cancel": this.Close(); break; } } } When in the switch, case "OK", the DataContext contains the correct information, but the originally passed NewsServer instance does not change.

    Read the article

  • Problem sending mail with simple .net application. Server refusal error.

    - by Fatih
    I have a very simple .net application for testing SMTP on .net. But i am receiving this weird error. "System.Net.Mail.SmtpException: Failure sending mail. --- System.Net.WebException: Unable to connect to the remote server --- System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it" SMTP server is remote and doesn't need any kind of authentication so i don't need credentials. But i can send mails from this computer with outlook using same smtp server and same smtp settings without any problem. Any ideas? It will be appreciated so much. Imports System.Net.Mail Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim smtp As New SmtpClient smtp.Host = "10.241.128.220" smtp.Port = 25 smtp.Send("[email protected]", "[email protected]", "test", "test") End Sub

    Read the article

  • Unique identifier for an email

    - by Skywalker
    I am writing a C# application which allows users to store emails in a MS SQL Server database. Many times, multiple users will be copied on an email from a customer. If they all try to add the same email to the database, I want to make sure that the email is only added once. MD5 springs to mind as a way to do this. I don't need to worry about malicious tampering, only to make sure that the same email will map to the same hash and that no two emails with different content will map to the same hash. My question really boils down to how one would combine multiple fields into one MD5 (or other) hash value. Some of these fields will have a single value per email (e.g. subject, body, sender email address) while others will have multiple values (varying numbers of attachments, recipients). I want to develop a way of uniquely identifying an email that will be platform and language independent (not based on serialization). Any advice?

    Read the article

  • Disable text selection UITextView

    - by marcio
    Hello, i want to disable text selection on a UITextView. Until now what i've already done is: - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { [UIMenuController sharedMenuController].menuVisible = NO; if (action == @selector(paste:)) return NO; if (action == @selector(select:)) return NO; if (action == @selector(selectAll:)) return NO; return NO; } In this away i set UIMenuController to hidden and i put a stop to text copy but the text selection is still visible. Google results (also stackoverflow) take me to no solution. Has someone already faced the same problem? Any ideas? Thanks in advance, marcio

    Read the article

  • queston related to popToViewController

    - by user217572
    My Secondview is BController *bview. now in this view there is 1 back button on click of that back button -(IBAction)done:(id)sender { AController *aview= [[AController alloc] initWithNibName:@"AController" bundle:[NSBundle mainBundle]]; NSArray *array = [self.navigationController popToViewController: aview animated:YES]; } AController *aview is nothing but my first view or u can say first view but in click of back button i'm getting exception ** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Tried to pop to a view controller that doesn't exist.' 2010-03-18 15:53:05.948 IChitMe[5072:207] Stack: ( 820145437, 837578260, 819694387, 814928571, 862794500, 862794216, 54911, 819902607, 861951876, 862404412, 819902607, 861951876, 861951724, 861951668, 861950732, 861953932, 861948160, 861945748, 861927312, 861925524, 858687888, 819893547, 819891231, 858682228, 861592624, 861585968, 10069, 9964 ) terminate called after throwing an instance of 'NSException'

    Read the article

  • WPF DataGrid - Can't Use Mouse To Scroll Because Of Drag Drop

    - by OrPaz
    Hello, I am using a datagrid that is allowing to drag its rows. My problem is that when i try to scroll down on my grid using the mouse on the side scroller, i get the 'no enterance' sign that means that "drag and drop is not allowed here, dude...". How can i modify my drag and drop function to recognize that this is not a drag and drop action, but a scroll mouse action? private new void MouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { Point currentPosition = e.GetPosition(GridUC); Object selectedItem = GridUC.SelectedItem; if (selectedItem == null) return; DragDropContainerObject ddObject = new DragDropContainerObject(typeof(Actor), selectedItem); DataGridRow container = (DataGridRow)GridUC.ItemContainerGenerator.ContainerFromItem(selectedItem); if (container != null) { DragDropEffects finalDropEffect = DragDrop.DoDragDrop(container, ddObject, DragDropEffects.Link); } } }

    Read the article

  • How cancel shutdown from a windows service C#

    - by scrat789
    Hello everybody I have a windows service started (written in C# .net2.0). I want to detect when the computer shutdown/reboot and cancel it. After the cancel I want do some actions and restart windows. I have tried it, but it not working using Microsoft.Win32; partial class MyService: ServiceBase { protected override void OnStart(string[] args) { SystemEvents.SessionEnding += new SessionEndingEventHandler(OnSessionEnding); } private void OnSessionEnding(object sender, SessionEndingEventArgs e) { e.Cancel = true; //Do some work... } } Another test: partial class MyService: ServiceBase { protected override void OnShutdown() { //Do some work... //base.OnShutdown(); } }

    Read the article

  • When we should use pushScene and replaceScene in cocos2d ?

    - by srikanth rongali
    Hi, I cocos2d, I am using pushScene and replaceScene to move to next scene. But, I am confused which we should use? When I am using replaceScene in some places app is crashing and giving errors like -[UITextView length]: unrecognized selector sent to instance 0x842a750 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UITextView length]: unrecognized selector sent to instance 0x842a750' But, in my program I am not passing length to UITextView. My program is in this way In scene1 I have UITextView, and I am replacing this scene with scene2. Then -(id)buttonPressed:(id)sender { [description removeFromSuperview]; // It is the textView(description) CCScene *Scene = [CCScene node]; CCLayer *Layer = [scene2 node]; [Scene addChild:Layer]; [[CCDirector sharedDirector] setAnimationInterval:1.0/60]; [[CCDirector sharedDirector] replaceScene: Scene]; } But, when I am using pushScene in presence of replaceScene it is working good. Please clarify me which one should use in which cases ? Thank You

    Read the article

  • Saving State Dynamic UserControls...Help!

    - by Cognitronic
    I have page with a LinkButton on it that when clicked, I'd like to add a Usercontrol to the page. I need to be able to add/remove as many controls as the user would like. The Usercontrol consists of three dropdownlists. The first dropdownlist has it's auotpostback property set to true and hooks up the OnSelectedIndexChanged event that when fired will load the remaining two dropdownlists with the appropriate values. My problem is that no matter where I put the code in the host page, the usercontrol is not being loaded properly. I know I have to recreate the usercontrols on every postback and I've created a method that is being executed in the hosting pages OnPreInit method. I'm still getting the following error: The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases. Here is my code: Thank you!!!! bool createAgain = false; IList<FilterOptionsCollectionView> OptionControls { get { if (SessionManager.Current["controls"] != null) return (IList<FilterOptionsCollectionView>)SessionManager.Current["controls"]; else SessionManager.Current["controls"] = new List<FilterOptionsCollectionView>(); return (IList<FilterOptionsCollectionView>)SessionManager.Current["controls"]; } set { SessionManager.Current["controls"] = value; } } protected void Page_Load(object sender, EventArgs e) { Master.Page.Title = Title; LoadViewControls(Master.MainContent, Master.SideBar, Master.ToolBarContainer); } protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); System.Web.UI.MasterPage m = Master; Control control = GetPostBackControl(this); if ((control != null && control.ClientID == (lbAddAndCondtion.ClientID) || createAgain)) { createAgain = true; CreateUserControl(control.ID); } } protected void AddAndConditionClicked(object o, EventArgs e) { var control = LoadControl("~/Views/FilterOptionsCollectionView.ascx"); OptionControls.Add((FilterOptionsCollectionView)control); control.ID = "options" + OptionControls.Count.ToString(); phConditions.Controls.Add(control); } public event EventHandler<Insight.Presenters.PageViewArg> OnLoadData; private Control FindControlRecursive(Control root, string id) { if (root.ID == id) { return root; } foreach (Control c in root.Controls) { Control t = FindControlRecursive(c, id); if (t != null) { return t; } } return null; } protected Control GetPostBackControl(System.Web.UI.Page page) { Control control = null; string ctrlname = Page.Request.Params["__EVENTTARGET"]; if (ctrlname != null && ctrlname != String.Empty) { control = FindControlRecursive(page, ctrlname.Split('$')[2]); } else { string ctrlStr = String.Empty; Control c = null; foreach (string ctl in Page.Request.Form) { if (ctl.EndsWith(".x") || ctl.EndsWith(".y")) { ctrlStr = ctl.Substring(0, ctl.Length - 2); c = page.FindControl(ctrlStr); } else { c = page.FindControl(ctl); } if (c is System.Web.UI.WebControls.CheckBox || c is System.Web.UI.WebControls.CheckBoxList) { control = c; break; } } } return control; } protected void CreateUserControl(string controlID) { try { if (createAgain && phConditions != null) { if (OptionControls.Count > 0) { phConditions.Controls.Clear(); foreach (var c in OptionControls) { phConditions.Controls.Add(c); } } } } catch (Exception ex) { throw ex; } } Here is the usercontrol's code: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FilterOptionsCollectionView.ascx.cs" Inherits="Insight.Website.Views.FilterOptionsCollectionView" %> namespace Insight.Website.Views { [ViewStateModeById] public partial class FilterOptionsCollectionView : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } protected override void OnInit(EventArgs e) { LoadColumns(); ddlColumns.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(ColumnsSelectedIndexChanged); base.OnInit(e); } protected void ColumnsSelectedIndexChanged(object o, EventArgs e) { LoadCriteria(); } public void LoadColumns() { ddlColumns.DataSource = User.GetItemSearchProperties(); ddlColumns.DataTextField = "SearchColumn"; ddlColumns.DataValueField = "CriteriaSearchControlType"; ddlColumns.DataBind(); LoadCriteria(); } private void LoadCriteria() { var controlType = User.GetItemSearchProperties()[ddlColumns.SelectedIndex].CriteriaSearchControlType; var ops = User.GetItemSearchProperties()[ddlColumns.SelectedIndex].ValidOperators; ddlOperators.DataSource = ops; ddlOperators.DataTextField = "key"; ddlOperators.DataValueField = "value"; ddlOperators.DataBind(); switch (controlType) { case ResourceStrings.ViewFilter_ControlTypes_DDL: criteriaDDL.Visible = true; criteriaText.Visible = false; var crit = User.GetItemSearchProperties()[ddlColumns.SelectedIndex].SearchCriteria; ddlCriteria.DataSource = crit; ddlCriteria.DataBind(); break; case ResourceStrings.ViewFilter_ControlTypes_Text: criteriaDDL.Visible = false; criteriaText.Visible = true; break; } } public event EventHandler OnColumnChanged; public ISearchCriterion FilterOptionsValues { get; set; } } }

    Read the article

  • C# sendkeys to calculator

    - by user203123
    The sendkeys code below works well for Notepad but it doesn't work for Calculator. What is the problem? (It's another problem compared to what I sent here http://stackoverflow.com/questions/2604486/c-sendkeys-problem) [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern IntPtr FindWindow(string lpClassName,string lpWindowName); [DllImport("User32")] public static extern bool SetForegroundWindow(IntPtr hWnd); private void button1_Click(object sender, EventArgs e) { IntPtr calculatorHandle = FindWindow("SciCalc", "Calculator"); //IntPtr calculatorHandle = FindWindow("Notepad", "Untitled - Notepad"); if (calculatorHandle == IntPtr.Zero) { MessageBox.Show("Calculator is not running."); return; } SetForegroundWindow(calculatorHandle); System.Threading.Thread.Sleep(1000); SendKeys.SendWait("111*11="); //SendKeys.SendWait("{ENTER}"); //cnt++; SendKeys.Flush(); }

    Read the article

  • wpf prevent second click button

    - by neki
    hi! i have a problem again. when i click button, window appears. when i click button again same window appears again. i want when i click button first time, page appears. but i wanna prevent second click. can anyone help me about this problem? thanks in advance. private void Dictionary_Click(object sender, RoutedEventArgs e) { Dictionary dic = new Dictionary(); dic.Show(); dic.Topmost = true; }

    Read the article

  • problem with sqldatasource and data binding

    - by Alexander
    I am trying to pull out data from the table I had from the database according to the id which is passed from the URL. However I always get data from id= 1? Why? FYI I took this code directly from the ClubWebsite starter kit and copy and paste it to my project to make several changes, the ClubWebsite one worked fine.. but this one doesn't and can't find any reason why because they both looked exactly the same. <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Events_View.aspx.cs" Inherits="Events_View" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="splash" Runat="Server"> <div id="splash4">&nbsp;</div> </asp:Content> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <div id="content"> <div class="post"> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ClubDatabase %>" SelectCommand="SELECT dbo.Events.id, dbo.Events.starttime, dbo.events.endtime, dbo.Events.title, dbo.Events.description, dbo.Events.staticURL, dbo.Events.address FROM dbo.Events"> <SelectParameters> <asp:Parameter Type="Int32" DefaultValue="1" Name="id"></asp:Parameter> </SelectParameters> </asp:SqlDataSource> <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="id" AllowPaging="false" Width="100%"> <ItemTemplate> <h2> <asp:Label Text='<%# Eval("title") %>' runat="server" ID="titleLabel" /> </h2> <div> <br /> <p> <asp:Label Text='<%# Eval("address") %>' runat="server" ID="addressLabel" /> </p> <p> <asp:Label Text='<%# Eval("starttime","{0:D}") %>' runat="server" ID="itemdateLabel" /> <br /> <asp:Label Text='<%# ShowDuration(Eval("starttime"),Eval("endtime")) %>' runat="server" ID="Label1" /> </p> </div> <p> <asp:Label Text='<%# Eval("description") %>' runat="server" ID="descriptionLabel" /> </p> </ItemTemplate> </asp:FormView> <div class="dashedline"> </div> </div> </div> </asp:Content> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; using System.Data; public partial class Events_View : System.Web.UI.Page { const int INVALIDID = -1; protected void Page_Load(object sender, System.EventArgs e) { SqlDataSource1.SelectParameters["id"].DefaultValue = System.Convert.ToString(EventID); } public int EventID { get { int m_EventID; object id = ViewState["EventID"]; if (id != null) { m_EventID = (int)id; } else { id = Request.QueryString["EventID"]; if (id != null) { m_EventID = System.Convert.ToInt32(id); } else { m_EventID = 1; } ViewState["EventID"] = m_EventID; } return m_EventID; } set { ViewState["EventID"] = value; } } protected void FormView1_DataBound(object sender, System.EventArgs e) { DataRowView view = (DataRowView)(FormView1.DataItem); object o = view["staticURL"]; if (o != null && o != DBNull.Value) { string staticurl = (string)o; if (staticurl != "") { Response.Redirect(staticurl); } } } protected string ShowLocationLink(object locationname, object id) { if (id != null && id != DBNull.Value) { return "At <a href='Locations_view.aspx?LocationID=" + Convert.ToString(id) + "'>" + (string)locationname + "</a><br/>"; } else { return ""; } } protected string ShowDuration(object starttime, object endtime) { DateTime starttimeDT = (DateTime)starttime; if (endtime != null && endtime != DBNull.Value) { DateTime endtimeDT = (DateTime)endtime; if (starttimeDT.Date == endtimeDT.Date) { if (starttimeDT == endtimeDT) { return starttimeDT.ToString("h:mm tt"); } else { return starttimeDT.ToString("h:mm tt") + " - " + endtimeDT.ToString("h:mm tt"); } } else { return "thru " + endtimeDT.ToString("M/d/yy"); } } else { return starttimeDT.ToString("h:mm tt"); } } }

    Read the article

  • How do I let main thread wait for the Timer.timer

    - by Kelvin
    Hi I am using System.Timer.Timer I always get NULL after running my programme and it only works if I add this.sleep(6000). Suppose the reason is the main thread ends but the timer hasn't finished ... Here is the class and I call the class from my main form. Class class1 { string finalResult = ""; public string getNumber() { RunTimer(); return finalResult; } pubic void RunTimer () { timer = new System.Timers.Timer(6000); timer.Interval = 1000; timer.Elapsed += new System.Timers.ElapsedEventHandler(cal); timer.Start(); } private void cal(object sender,System.Timers.ElapsedEventArgs e) { finalResult = READFROMCOMPORT; } }

    Read the article

  • RowsDeleting event doesn't fire

    - by iTayb
    I have a gridview with a onrowdeleting="SellersGridView_RowsDeleting" switch. My method is: protected void SellersGridView_RowsDeleting(object sender, GridViewDeleteEventArgs e) { string seller = ((Label)SellersGridView.Rows[e.RowIndex].Cells[0].FindControl("TextBoxSeller")).Text; BookStore b = new BookStore(); b.LoadFromXML(Server.MapPath("list.xml")); string ISBN = Request.QueryString["ISBN"].ToString(); int ID = b.BooksList.FindIndex(x => x.ISBN == ISBN); Book myBook = b.BooksList[ID]; myBook.RemoveSeller(seller); Response.Redirect("editbook.aspx?ISBN=" + ISBN); } Well, it seems that when I try to delete anything - nothing happens. I tried to change the first line to Response.Redirect("foo") just to check if the event itself is fired, and it turns out that it doesn't. I can't get The reason. Here is my gridview control: http://pastebin.com/CKDAMECT Here is my codebehind code: http://pastebin.com/ShBtwGEu Thank you very much!

    Read the article

  • SQL 2008 SMO Database Status property memory leak.

    - by AKoran
    It appears there is a memory leak in the Status property of the SMO Database class. Using the code below with SQL 2005 SMO libraries works fine, but as soon as you use SQL 2008, the memory leak appears.... Any other good way of getting the database staus in SQL 2008? A quick example that magnifies the problem: private void button1_Click(object sender, RoutedEventArgs e) { for (int x = 0; x < 100; x++) { CheckStatus(); } } private void CheckStatus() { Server server = new Server("YourServer"); DatabaseCollection dbc = server.Databases; if (dbc.Contains("YourDatabase")) { DatabaseStatus dbStatus = dbc["YourDatabase"].Status; } }

    Read the article

< Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >