asp.net,visual-studio-2013,code-behind
This option is only available for websites not web applications, go to File->New->Website and create a new website, then you can choose to have the code behind on the same page or separate page when you are adding new pages. Keep in mind there are differences between a website and...
asp.net,code-behind,site.master
Yes there is a way to do this. You need to set UseSubmitBehavior button property to false and then you can access the control that causes the post back using Request.Params.Get("__EVENTTARGET"); So the code would look like this: Button definition in Site.Master markup: <asp:Button ID="MyButton" runat="server" Text="Button" UseSubmitBehavior="false" /> code...
c#,rdlc,code-behind,export-to-pdf
Try this. protected void showReport(string fileName) { Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; DataTable DataTable1 = new DataTable report.LocalReport.Refresh(); report.Reset(); report.LocalReport.EnableExternalImages = true; this.report.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportDataSource rds2 = new ReportDataSource("DataSet1", DataTable1); report.LocalReport.DataSources.Add(rds2);...
mvvm,code-behind,datacontext,passwordbox
Yes it can be handled in many ways. There is nothing wrong with code-behind. Your current solution has the problem that you're tying concrete viewmodel with PasswordBox which makes it NON reusable for other viewmodels. Better way is to write attached property with event listeners. There are many resources that...
c#,wpf,event-handling,label,code-behind
If I understand this correctly, you want a Label with a LeftMouseDown-event, which you would write from code? In that case: TestLabel.MouseLeftButtonDown += new MouseButtonEventHandler(TARGET); ...
asp.net,background-image,code-behind,spaces,datareader
You can use Uri.EscapeDataString() Uri.EscapeDataString(drVideo["imageName"].ToString()) This will replace space with %20...
javascript,asp.net,vb.net,code-behind
The problem here is that Javascript is executed in the browser on the client-side, not on the server. This means that by the time the Javascript runs, the VB on the server is already completely finished executing. Your best option is to find a way to check the value while...
javascript,c#,asp.net,ajax,code-behind
Assuming your GetAccount method can be reached at /Account/GetAccount when your application runs, you could use the following: $.ajax({ type: 'GET', url: '/Account/GetAccount', data: { 'username' : 'a-username' }, dataType: 'json', success: function(jsonData) { alert(jsonData); }, error: function() { alert('error'); } }); Note - this is dependant on jQuery. This...
wpf,charts,code-behind,lineseries
Have you tried adding a Style for the serie's Polyline instead? It seams the style for the LineDataPoint is actually for every point on the serie. Here is a working sample of a chart fully created on code-behind. You just have to create a window named MainWindow and add a...
c#,asp.net,visual-studio-2010,code-behind
Look in the header of the .aspx file. There should be a property named CodeBehind which references to your code file. Is something as CodeBehind="yourfile.aspx.cs" If this property is not present, the C# code is placed inside script tags in your aspx. If this property is present, references the cs...
Physically moving ASPX/ASCX files is not enough for them to work again. You need to also update the corresponding file's page/control directive. You have to change the CodeBehind value of the @Page directive to reflect the new path. Your ASPX page probably has something like this: <%@Page CodeBehind="~/Master/Employee.aspx.cs" ... %>...
c#,asp.net,.net,master-pages,code-behind
I think you should be using var txt1 = Content1.FindControl("TextBox1") and then if the txt1 is not null use it as you would normally use TextBox1 ? var txt1 = Content1.FindControl("TextBox1"); txt1.Text = "some value"; ...
Add reference to System.Deployment library to your project and adjust this snippet to your code: using System.Deployment.Application; and string version = null; try { //// get deployment version version = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(); } catch (InvalidDeploymentException) { //// you cannot read publish version when app isn't installed //// (e.g. during debug) version...
Unfortunately, FindControl doesn't find nested controls. From MSDN: This method will find a control only if the control is directly contained by the specified container; that is, the method does not search throughout a hierarchy of controls within controls. Example: <asp:Panel ID="pnl" runat="server"> <asp:Label ID="lbl" runat="server" Text="I'm here!" /> </asp:Panel>...
It's a little fiddly, but it can be done. The basic premise is to take a note of what you have selected before you select everything; and then reselect those records after the copy. Not the ToList() after the Distinct() is important. It will not work without this because of...
c#,asp.net,.net,code-behind,webmethod
Simply, you can't. The property Page is not available to a static method, and that makes sense, since in the context of that static WebMethod, you don't have a page. You could save the relevant properties in a Session variable and get it from the session info in your WebMethod....