Search Results

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

Page 92/174 | < Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >

  • SQL ConnectionString in web.config and global.asax implications

    - by rlb.usa
    This is going to sound very odd, but I have a web.config like this: <connectionStrings> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Data Source=BACKUPDB;..." providerName="System.Data.SqlClient"/> </connectionStrings> And a global.asax like this: void Session_Start(object sender, EventArgs e) { // Code that runs when a new session is started if (Application["con"] == null || Application["con"] == "") { Application["con"] = "Data Source=PRODUCTIONDB;..."; } } And EVERYWHERE in my code, I reference my ConnectionStrings like this: SqlConnection con = new SqlConnection(Convert.ToString(HttpContext.Current.Application["con"])); However, I see that everything I do inside this application goes to BACKUP db instead of PRODUCTIONDB. What is going on, how could this happen, and why? It doesn't make any sense to me, and it got me into a lot of trouble. We use LocalSqlServer string for FormsAuthentication.

    Read the article

  • Add the Date Filter SharePoint webpart to an ASP.Net page

    - by Javaman59
    I want to add the out-of-the-box SharePoint date filter webpart to an ASP.Net web page. I want to do it either in an ASPX... <%@ Register Assembly="<DatePickerDLL??>" Namespace="<??>" TagPrefix="DP" %> <...> <asp:WebPartManager ID="WebPartManager1" runat="server"> </asp:WebPartManager> <...> <ZoneTemplate> <DP:<DatePickerWebPart??> ID="DatePicker" runat="server" /> or programmatically, in the ASPX.CS protected void Page_Load(object sender, EventArgs e) { this.Controls.Add(<Microsoft.Something.DatePicker??> }

    Read the article

  • help me to cheat with numericUpDown1_ValueChanged event

    - by alex
    I have a Form and numericupdown control located on it. I want that in some conditions (_condition1) user cannot be able to change a value of numericupdown control. How can I do it ? I wrote some code but it works twice (double time). class Form1 : Form { bool _condition1; int _previousValue; void numericUpDown1_ValueChanged(object sender, EventArgs e) { if(_condition1) { numericUpDown1.Value = (decimal)_previousValue; } else { _previousValue = (int)numericUpDown1.Value; } } } Control must be enable.

    Read the article

  • adding row dyanamicaly to gridview in WPF

    - by user572914
    Please help me with the following code,I want to add a row inputted by user to a gridview. I am able to add a row but its empty!!Please help.it worked in windows forms but its not working with WPF. private void button1_Click(object sender, RoutedEventArgs e) { GetGridView(); } private void GetGridView() { string[] row0 = {textBox1.Text,"Beatles" }; dataGrid1.Items.Add(row0); dataGrid1.Columns[0].DisplayIndex = 0; dataGrid1.Columns[1].DisplayIndex = 1; } ////////////// sure,here it is

    Read the article

  • PRISM View Injection/Navigation in Same Module

    - by Jeaffrey Gilbert
    This is ModuleInit.cs in Products module public class ModuleInit : IModule { private readonly IUnityContainer _container; private readonly IRegionManager _regionManager; public ModuleInit(IUnityContainer container, IRegionManager regionManager) { _container = container; _regionManager = regionManager; } #region IModule Members public void Initialize() { App app = (App)Application.Current; _regionManager.RegisterViewWithRegion(RegionNames.ModuleRegionProducts, () => _container.Resolve<Views.ProductsCycle>()); } #endregion } Below is button event handler in ProductsCycle.cs to go to another view still within same module: private void btnForward_Click(object sender, RoutedEventArgs e) { IRegion productsRegion = _regionManager.Regions["ModuleRegionProducts"]; var productsListView = _container.Resolve<Views.ProductsList>(); productsRegion.Add(productsListView, "ProductsList"); productsRegion.Activate(productsListView); } State: ProductsCycle page is successfully loaded on first load. Problem: View doesn't changed from ProductCycle page to ProductsList page when btnForward is clicked. I'm using Silverlight 4 and PRISM2. Please your advice, thank you.

    Read the article

  • problem running system.net.webclient and process.start off a control event

    - by Rob
    The following code causes my vs 2008 wpf project to hang, I'm not sure why. Both Part 1 and Part 2 work perfectly fine independently, but when I run them together on an control event (click a button for example) the program hangs. I've also tried shell execute for part 2 - same results. However, this code when run within the form loaded event works fine. Any insights would be truly appreciated. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click 'Part 1 Dim myWebClient As System.Net.WebClient = New System.Net.WebClient Dim CurrentDataFileContents As String = myWebClient.DownloadString("http://www.xyz.com") myWebClient.Dispose() 'Part 2 System.Diagnostics.Process.Start("http://www.test.com") End Sub

    Read the article

  • iPhone UINavigation Controller issue?

    - by NextRev
    I have 3 different xib's. I am able to go back and forth between view 1 and view 2 with the following code... This Code brings up the second view... -(IBAction)startButtonClicked:(id)sender{ self.gamePlayViewController = [[GamePlayViewController alloc] initWithNibName:@"GamePlayViewController" bundle:nil]; [self.navigationController pushViewController:gamePlayViewController animated:YES]; [GamePlayViewController release]; } This Code is executed in the second view and brings me back to the first view... -(IBAction)backButtonClicked{ [self.navigationController popViewControllerAnimated:YES]; } Now when I try to execute this code (in the second view) to get to the third view...I get SIGABRT and the app crashes...why does it work for the first view bringing up the second view, but not for the second view bringing up the 3rd view? -(IBAction)nextView{ self.thirdViewController = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil]; [self.navigationController pushViewController:thirdViewController animated:YES]; [thirdViewController release]; }

    Read the article

  • Is there anyway to reduce IsolatedStorage capacity in Silverlight?

    - by Edward Tanguay
    With this code I can have Silverlight ask the user if he wants to increase IsolatedStorage: private void Button_IncreaseIsolatedStorage_Click(object sender, RoutedEventArgs e) { IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication(); long newStorageCapacityInBytes = FileHelpers.GetMaxiumumSpace() + SystemHelpers.GetAmountOfStorageToIncreaseWhenNeededInBytes(); store.IncreaseQuotaTo(newStorageCapacityInBytes); Message = "IsolatedStorage increased. " + FileHelpers.GetSpaceLeftMessage(); } But if I try to set it to an amount less than it current is, I get an error that this is not possible. 1. Is there a workaround for this, i.e. can I reduce the amount of IsolatedStorage? 2. When the user agrees to increasing IsolatedStorage, can other applications use this capacity or just the application in which he increased it?

    Read the article

  • is there any IIS setting require for url rewriting?

    - by Samir
    Hello, i have used URL rewriting using global.asax file. url rewriting is working file on local machine but when i made it online its not working. void Application_BeginRequest(Object sender, EventArgs e) { var extension = Path.GetExtension(Request.PhysicalPath).ToLower(); if (File.Exists(Request.PhysicalPath)) { if (extension == ".html") { Response.WriteFile(Request.PhysicalPath); Response.End(); } return; } var path = Request.Path; if (!Context.Items.Contains("ORIGINAL_REQUEST")) Context.Items.Add("ORIGINAL_REQUEST", path); if (extension == ".html") { var resource = UrlRewriting.FindRequestedResource(); var command = UrlRewriting.GetExecutionPath(resource); Context.RewritePath(command, true); } } url is:ind205.cfmdeveloper.com when you click on about us ,demo,advertise page it will not display. so please let me know is there any IIS setting require, reply me soon thanks Samir

    Read the article

  • Need to store GridViewDateTimeValue into DateTimePicker

    - by narmadha
    Hi,I am Using Gridview in WindowsApplication.The following is my code: if (dgvList.SelectedRows.Count > 0) { if (dgvList.SelectedRows[0].Cells != null) { DataGridViewRow dr = dgvList.CurrentRow; txtMaterialName.Text = dr.Cells["MaterialName"].ToString(); dateTimePicker1.Text=DateTime.Parse(dr.Cells["PurchasedDate"].ToString()).ToString(); } } i need to store the PurchasedDate into DateTimePicker,But the Error is "The string was not recognized as a valid DateTime. There is a unknown word starting at index 0." Source="mscorlib" StackTrace: at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) at System.DateTime.Parse(String s) at Godwins.EditStockAvailabilty.dgvList_SelectionChanged(Object sender, EventArgs e) Can anyone help me,Thanks in advance.........

    Read the article

  • WindowsForms difference to simple Console App

    - by daemonfire300
    I currently started to "port" my console projects to WinForms, but it seems I am badly failing doing that. I am simply used to a console structure: I got my classes interacting with each other depending on the input coming from the console. A simple flow: Input -> ProcessInput -> Execute -> Output -> wait for input Now I got this big Form1.cs (etc.) and the "Application.Run(Form1);" But I really got no clue how my classes can interact with the form and create a flow like I described above. I mean, I just have these "...._Click(object sender....)" for each "item" inside the form. Now I do not know where to place / start my flow / loop, and how my classes can interact with the form.

    Read the article

  • cant login using System.Diagnostics.Process.Start

    - by omair iqbal
    i am tying to login using System.Diagnostics.Process.Start private void button1_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start("iexplore","[email protected]","password","http://www.gmail.com"); } but visual studio gives me these 2 errors: Error 1 The best overloaded method match for 'System.Diagnostics.Process.Start(string, string, System.Security.SecureString, string)' has some invalid arguments C:\Documents and Settings\Omair\My Documents\Visual Studio 2008\Projects\WindowsFormsApplication3\WindowsFormsApplication3\Form1.cs 21 13 WindowsFormsApplication3 and Error 2 Argument '3': cannot convert from 'string' to 'System.Security.SecureString' C:\Documents and Settings\Omair\My Documents\Visual Studio 2008\Projects\WindowsFormsApplication3\WindowsFormsApplication3\Form1.cs 21 80 WindowsFormsApplication3 note: i am brand new to c# and reletively new to the world of programming sorry for my english

    Read the article

  • Why won't my anonymous function fire on grid.prerender?

    - by adam0101
    In my gridview I have fields for inserting a new record in the footer. In my objectdatasource selecting event if no records came back I bind a single mock row to force the footer to show so they can still add records. Since the row does not contain real data I hide the row. ... If result.ItemCount = 0 Then result = mockRow AddHandler mygridview.PreRender, AddressOf HideRow End If End Sub Private Sub HideRow(ByVal sender as Object, ByVal e as EventArgs) mygridview.Rows(0).Visible = False End Sub This works fine. However, I'd like to condense it like this: ... If result.ItemCount = 0 Then result = mockRow AddHandler mygridview.PreRender, Function() mygridview.Rows(0).Visible = False End If End Sub This compiles fine, but the row doesn't get hidden. Can anyone tell me why my anonymous function isn't getting hit?

    Read the article

  • C# Reflection - Casting private Object field

    - by alhazen
    I have the following classes: public class MyEventArgs : EventArgs { public object State; public MyEventArgs (object state) { this.State = state; } } public class MyClass { // ... public List<string> ErrorMessages { get { return errorMessages; } } } When I raise my event, I set 'State' of the MyEventArgs object to an object of type MyClass. I'm trying to retrieve ErrorMessages by reflection in my event handler: public static void OnEventEnded(object sender, EventArgs args) { Type type = args.GetType(); FieldInfo stateInfo = type.GetField("State"); PropertyInfo errorMessagesInfo = stateInfo.FieldType.GetProperty("ErrorMessages"); object errorMessages = errorMessagesInfo.GetValue(null, null); } But this returns errorMessagesInfo as null (even though stateInfo is not null). Is it possible to retrieve ErrorMessages ? Thank you

    Read the article

  • ASP.NET SetAuthCookie Impersonation Help

    - by rlb.usa
    Hello SO, I'm trying to do user impersonation for a web application we have. The user selects the user they'd like to emulate/impersonate and then clicks the button which fires this: protected void uxImpersonate_Click(object sender, EventArgs e) { ... FormsAuthentication.SetAuthCookie(uxUserToEmulate.SelectedValue, false); Response.Redirect("Impersonation.aspx"); //reload page manually } We have a dev - test - production server environment and on two servers this works just fine, but on another one, in all browsers, it kicks me to the login screen. What's going on and how can I fix it? We're on ASP.NET 2.0, and I'm using http://stackoverflow.com/questions/549016/user-impersonation-with-asp-net-forms-authentication as a guide. UPDATE: It appears that the user actually is impersonated successfully but is loosing their Role as admin (only Admin Role's can access this impersonation page).

    Read the article

  • convert server side vb.net to client side javascript

    - by rockinthesixstring
    I've got a function I wrote quite some time ago that works fine, but I'd like to speed up the process and lessen server load by doing the same job in Javascript. I seem to be able to GET textbox values ok, but I can't seem to SET textbox values (I'm'-a JS noob). Can anyone lend a hand in converting my VB.NET code to it's JS equivalent? Protected Sub txtSellingPrice_TextChanged(ByVal sender As Object, ByVal e As EventArgs) _ Handles txtSellingPrice.TextChanged Dim SellingPrice As Double = Double.Parse(txtSellingPrice.Text.Replace("$", "")) Dim BallanceSheet As Double = If(txtBalanceSheet.Text = "", 0, Double.Parse(txtBalanceSheet.Text.Replace("$", ""))) Dim DownPayment As Double = If(txtDownPayment.Text = "", 0, Double.Parse(txtDownPayment.Text.Replace("$", ""))) txtGoodWill.Text = SellingPrice - BallanceSheet txtBalance.Text = SellingPrice - DownPayment txtSellingPriceMult.Text = SellingPrice End Sub I've got this so far, but I'm not sure how to get much further. function txtSellingPrice_OnChange() { var txtSellingPrice = document.getElementById('<%=txtSellingPrice.ClientID %>') var txtBalanceSheet = document.getElementById('<%=txtBalanceSheet.ClientID %>') var txtDownPayment = document.getElementById('<%=txtDownPayment.ClientID %>') }

    Read the article

  • form not showing

    - by Luke
    Perhaps this has something to do with it being the mainForm, but I'll ask the question. I have my mainForm that is the first to load when the program is booted. I then click a button called Add, which should open a new form, and close the mainForm. The problem is, is shows the new form for a split second, then closes both. The code: private void addFrmBtn_Click(object sender, EventArgs e) { saveForm saveform = new saveForm(); saveform.Show(); this.Close(); }

    Read the article

  • Update gridview from code behind in asp.net

    - by Zerotoinfinite
    Hi Experts, I have gridview in my asp.net 3.5 application [C#]. Which looks like this: AutoGenerateDeleteButton="true" DataKeyNames="studentId" runat="server" OnRowEditing="GridView1_RowEditing" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowDeleting="GridView1_RowDeleting" OnRowUpdating="GridView1_RowUpdating" onpageindexchanging="GridView1_PageIndexChanging" onrowupdated="GridView1_RowUpdated" <EmptyDataTemplate> <asp:Label ID="lblNoRecord" runat="server" Text="No Record Found" ForeColor="Red"></asp:Label> </EmptyDataTemplate> </asp:GridView> Now, In rowUpdating event, I am writing the below code: protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { int mytext = Convert.ToInt16(GridView1.Rows[e.RowIndex].Cells[1].Text); string cConatiner = GridView1.Rows[e.RowIndex].Cells[4].Text; } In this, myText is giving me the correct value, i.e. of the 1st column but when I am changing the cell value to 1,2,3,4,5,6 I am getting empty. Am I doing it incorrectly ? Please help me. Thanks in advance.

    Read the article

  • In Cocoa, why won't a textfield be shown until after the IBAction is completely executed?

    - by Nano8Blazex
    I have an IBAction with some simple code inside: -(IBAction)change:(id)sender { [textfield setHidden:NO]; [self dolengthyaction]; } 'textfield' is an NSTextField in a nib file, and -'dolengthyaction' is a function that takes about a minute to finish executing. My question is: Why isn't the textfield shown until AFTER "dolengthyaction" is done executing? I want it to be revealed before the dolengthyaction starts taking place. Is this an inherent problem or is there something wrong with my code? (or in another part of my code?) I'm still not very good at programming so I apologize if I worded something badly and formatted something wrong.

    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

  • Why is e.Item.DataItem null on ItemDataBound event when binding an asp:net Repeater to a Collection?

    - by Clean
    Hi, I'm trying to bind a collection implementing the ICollection, IEnumerable and IList interface to an asp.net repeater. The Collection is named CustomCollection. So I'm setting the datasource of the repeater to the collection, as follows: rptRepeater.DataSource = customCollection; rptRepeater.Databind(); Then, on the ItemDataBound event, I'm trying to access the DataItem object, as follow: void rptRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e){ object obj = e.Item.DataItem; // DataItem is null for some reason } For some reason the e.Item.DataItem object is null. Do anyone know why this is, and/or what I could do to get hold of the object in the collection that is to be databound to the repeater? Thanx!

    Read the article

  • System.IndexOutOfRange Exception Sending Gridview Values to DataTable

    - by SidC
    Hello, I am writing an ASP.NET 3.5 application and need to send gridview values to a datatable for use in a listbox control as part of a quote process. I have written the following VB code in my Page_Load: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim dtSelParts As DataTable = New DataTable("dtSelParts") Dim column As DataColumn = New DataColumn column.ColumnName = "PartName" column.ColumnName = "PartNumber" column.ColumnName = "Quantity" dtSelParts.Columns.Add(column) For Each row As GridViewRow In MySearch.Rows Dim drSelParts As DataRow drSelParts = dtSelParts.NewRow() For i As Integer = 0 To row.Cells.Count - 1 drSelParts(i) = row.Cells(i).Text Next Next End Sub When I run the partsearch.aspx page, I enter values in the row textbox for parts I want included in the listbox (to be included in quote). However, I receive the error message System.Index.OutOfRangeException: Cannot find column 1 which occurs on the line drSelParts(i) = row.Cells(i).Text. How might I correct the code and resolve the error? Thanks, Sid

    Read the article

  • NUnit / Testdriven.Net conflicting results.

    - by panamack
    When I run this test in NUnit = Red Bar. [Test] public void ChangingValueViaPropertyDescriptorRaisesPropertyChangedNotification() { PropertyChangedEventArgs pCEventArgs = null; subjectVM.PropertyChanged += (sender, e) => { pCEventArgs = e; }; PropertyDescriptor descriptor = subjectVM.GetProperties().Find(schoolMeta.Name, false); descriptor.SetValue(null, "School's out for summer."); Assert.IsNotNull(pCEventArgs); Assert.AreEqual("School", pCEventArgs.PropertyName); } However, when I run this test from within Visual Studio with Test Driven .Net it passes. When it fails with NUnit it's because PropertyChanged is null, subjectVM is a View Model classes that inherits PropertyChanged from a base class. Am I to blame, or am I looking at a NUnit bug?

    Read the article

  • ObservableCollection and CollectionChanged Event

    - by wpfwannabe
    Why does the collectionchanged event not fire in the following code, yet I can see the new instance of InventoryBTO I add to the ObservableCollection? private ObservableCollection<InventoryBTO> _inventoryRecords; public ObservableCollection<InventoryBTO> InventoryRecords { get { return _inventoryRecords; } set { _inventoryRecords = value; } } private InventoryBTO _selectedRecord; public InventoryBTO SelectedRecord { get { return _selectedRecord; } set { if (_selectedRecord != value) { _selectedRecord = value; OnPropertyChanged(new PropertyChangedEventArgs("SelectedRecord")); } } } public InventoryViewModel() { if (_inventoryRecords == null) { InventoryRecords = new ObservableCollection<InventoryBTO>(); this.InventoryRecords.CollectionChanged += new NotifyCollectionChangedEventHandler(InventoryRecords_CollectionChanged); } _inventoryRecords = InventoryListBTO.GetAllInventoryRecords(); } void InventoryRecords_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { }

    Read the article

  • C# MDX RenderToSurface, where to reset after device is lost?

    - by Moritz Schöfl
    Hi, I got a problem with the RenderToSurface class. When I resize the Form of my Device, the Draw method is still called, but doesnt throw an Exception, it looks like this: device.Clear(ClearFlags.Target, Color.Red, 0, 0); device.BeginScene(); // here is out commented code device.EndScene(); device.Present(); In another method, I wrote this: renderToSurface.BeginScene(surfaces[currentIndex]); // here is out commented code renderToSurface.EndScene(Filter.None); and this method seems to throw a nullpointer exception when I resize the window; So my question is: - where to reset / restore / handle the renderToSurface class? (i tried it with the DeviceReset event like following - void OnDeviceReset(object sender, EventArgs e) { renderToSurface = new RenderToSurface(Game.Device, Game.ClientSize.Width, Game.ClientSize.Height, Format.A8R8G8B8, true, DepthFormat.D16); } )

    Read the article

< Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >