FAQ Database Discussion Community


What methods are executed in which order in this ASP.NET webforms page

c#,asp.net,webforms
I was refactoring some old website the other day and stumbled upon this scenario. I have an ASP.NET 3.5 C# WebForms page. In the code behind I have an event handler like so: protected override void OnPreRender(EventArgs e) { } On the other hand, in the markup, I also have:...

Using bootstrap icons in grid as command buttons

css,asp.net,twitter-bootstrap,webforms
I am trying to figure out how to use the bootstrap icons as buttons with CommandNames in a GridTemplateColumn or a GridButtonColumn. <telerik:GridTemplateColumn UniqueName="Commands"> <ItemTemplate> <asp:Button ID="btnDelete" CssClass="glyphicon glyphicon-remove-sign" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridButtonColumn ButtonCssClass="glyphicon glyphicon-minus-sign" /> At the very least I am trying to make a bootstrap icon act...

Page.Culture vs Thread.CurrentThread.CurrentCulture

c#,asp.net,razor,webforms,asp.net-webpages
I have been using Thread.CurrentThread.CurrentUICulture with System.Threading and System.Globalization, for a while now to manually set the language used by my ASP.net pages, mainly WebForms and WebPages with Razor. See MSDN: Thread.CurrentThread.CurrentUICulture I recently read a tutorial that was using Page.UICulture instead (actually, UICulture which appears to be strongly typed)....

Moving from Webforms to MVC 4 some basics [closed]

asp.net-mvc,vb.net,webforms
Being used to Webforms I'm having an issue 'visualising' MVC If I create a class (called Customers.vb) and add a string property Public Property Customers_CustomerName() As String ... add this function to the controller Function Index() As ActionResult Dim vCustomers As New Customers vService = New Service1Client strSQL = "SELECT...

Webforms asp:Panel children not showing fully in VS 2012

asp.net,visual-studio-2012,webforms
I'm wrestling with design time rendering of my custom WebForms components where I have defined a control derived from Panel and a second control derived from WebControl. I place the WebControl inside the Panel by dragging and dropping from the Toolbox. The problem I have is that at design time...

How to access properties of GridView Templete Field in Web Forms

c#,.net,gridview,webforms
I have .NET project on WebForms and GridView in it. GridView is populated with data from my DB. The DB has column named password but on GridView this column is set to Visible="False". When i click command button Edit all boxes are ready to be filled with new data, but...

how to align two labels and two textboxes without a gap in form-horizontal?

c#,asp.net,twitter-bootstrap,webforms
I am pretty new to using Bootstrap, and have hit a brick wall when trying to have a label, a textbox, a label and a textbox on the same line without a big gap between, and so that the State TextBox and Zip TextBox line up with the other TextBoxes...

using WebServices to read Customers Tables

c#,asp.net,webforms,dataset,asmx
I want to make WebMethod to my WebForms, beforehand this is my function [WebMethod] public DataSet GetCustomersData() { using(SqlConnection conn = new SqlConnection("MyConnString")) { try { conn.Open(); string commandstr = "select * from Customers ORDER BY CustomerID"; SqlCommand cmd = new SqlCommand(commandstr, conn); SqlDataAdapter SqlDa = new SqlDataAdapter(cmd); DataSet SqlDs...

Create Entity Model of Data in Azure Asp.Net

c#,asp.net,entity-framework,azure,webforms
I have created an ASP.NET Azure WebForms application. It has its default database and I can access it & modify AspNetUsers table using IdentityModel.cs (EntityFramework) as shown in many sites. Now I have created other tables in the database namely "Projects", "customers", etc. and also have designed aspx forms based...

Setting Up User Permissions

c#,asp.net,security,webforms,user-permissions
What is the best way to set-up page permissions based off username? Here is my predicament: I am needing to set-up user security and want to do this right from the start (why I ask). I will have users that are (and these names can be changed) in one of...

ASP.net Validation Control Interfering With Separate Controls

c#,asp.net,validation,web,webforms
I have a FormView on a page which allows a user to update an entry in the database. The database is defined using a code first approach, several fields are defined as being required. The form view is shown below, the form view works: <asp:FormView ID="BikeAdd" runat="server" ItemType="WLL.DAL.Bike" InsertMethod="BikeAdd_InsertItem" DefaultMode="Insert"...

How can I hide empty nested repeaters?

jquery,asp.net,webforms
In an asp.net page, I have nested repeaters to show up to four levels of my sitemap. The question: How can I tell the nested repeaters not to show a node if the node has no children? More specifically, when a nested repeater has no children, it renders as a...

Open specific tab on another page with ASP.NET Webforms

asp.net,twitter-bootstrap,twitter-bootstrap-3,webforms
I have a webforms website and I am using Bootstrap. I have a few links in my footer that will link to various tabs on different pages. My problem is that no matter what tab I specify the link to open, they only load the page with the default tab....

How to programmatically cancel .Net webforms ListView edit?

c#,asp.net,listview,webforms
I have a .Net WebForms application that uses a ListView and the built in edit capabilities. The page contains the ability to select the ListView data based on a dropdown. Currently when I change the data the row number that was being edited before changing the data, continues to use...

VB.NET redirection loop error

asp.net,redirect,webforms,infinite-loop,response.redirect
I have the following code on my multilingual website: (MasterPage.master.vb) Dim pageUrl As String = HttpContext.Current.Request.Url.AbsolutePath Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Dim strLanguage As String = Session("Language") If Not IsPostBack Then Response.Redirect(String.Format("{0}?Language={1}", pageUrl, strLanguage)) End If Response.Write(String.Format("{0}?Idioma={1}", pageUrl, strLanguage)) End Sub It will display the...

does not exist in the current context c# in my codes

c#,web,webforms
namespace ForumSon.App_Code.DataAccess { public class PostForum { public static int insertForum(int titleId, string question, string posterName, DateTime datetim) { int rowsAffected = 0; using (SqlConnection connection = ConnectionManager.GetDatabaseConnection()) { SqlCommand command = new SqlCommand("insertForum", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@titleId", SqlDbType.Int).Value = titleId; command.Parameters.Add("@question", SqlDbType.VarChar).Value = question;...

Asp:HyperLink onmouseover and onmouseout

html,asp.net,webforms
How could i do like this but using a <asp:HyperLink> instead? <li><a href="/url/" onmouseover="mopen('m1')" onmouseout="mclosetime()">Link</a> <div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="/url1/">Link1</a> <a href="/url2/">Link2</a> </div> </li> ...

ViewBag not declared in hybrid Webforms/MVC project

asp.net-mvc,razor,webforms,viewbag
I have an existing webforms project (.net 4.5.1) that I just added MVC to (I just created a new MVC project using Individual authentication and copied all of the bits to the Webforms project). When I navigate to something like Sitename/Home/index, it works fine and renders the page. However, when...

Why can't I put the webform into Views/Home folder?

c#,asp.net,asp.net-mvc,webforms,asp.net-mvc-5
I'm using ASP.NET MVC 5.2.2.0 (C#) within Webform. When I follow this step: right click solution -> Add -> New item... -> create new webform After debugging, that's work without a problem when I type "localhost/webform1.aspx" on url. But, when I do this: right click Views\Home folder -> Add ->...

Resource file not being picked up when using ASP.NET expression

c#,asp.net,webforms,localization,globalization
I'm trying to use resource files in an ASP.NET Web Forms application (.NET 4.0). I'm using VS2012. I have the following files inside the App_GlobalResources folder: Address.resx (default language, English) Address.ja-JP.resx (Japanese) The problem is when I'm trying to display the text in Japanese in an ASP.NET page (*.aspx file)....

Submit form that posts to another site

asp.net,forms,webforms
I have an online banking login that I'm trying to take from an old client site and put on their new site. If I copy the form and paste it into my new site, it just reloads the page when submitted. I've tried to change it to an asp.net form...

Is there an alternative to code render blocks?

c#,asp.net,.net,webforms
When I want to write the result of a function as-is onto a masterpage or aspx page without a span container created by a label, I use a code render block. It works, and it does the job reliably. My question is whether there is another way to achieve this...

ASP WebForms file download works only sometimes

asp.net,download,webforms
I developed code to add/remove/download files to orders and it works good. Downloading code: Response.Clear(); Response.ClearHeaders(); Response.ContentType = GetContentType(fileExtension); Response.AppendHeader("Content-Disposition", String.Format("attachment; filename=\"{0}\"", fileName)); Response.WriteFile(filePath); Response.Flush(); Response.Close(); Everything works good when code is in OnItemCommand method in DataList. protected void dlAttachemnts_OnItemCommand(object sender, DataListCommandEventArgs e) { if (e.CommandName ==...

Is Encrypted Token Pattern CSRF protection immune to BREACH attack?

webforms,csrf,csrf-protection
OWASP's Encrypted Token Pattern is a CSRF protection solution, where the token value is a function of time. Would this mean that Encrypted Token Pattern has a built in BREACH attack protection?

Asp.net textarea add empty string to the value [closed]

c#,asp.net,webforms,textarea
I have the textarea inside repeater <textarea class="form-control" disabled="disabled" > <%#Eval("value") %> </textarea> and when it's have value appear to have empty string in front and end of my string value Empty string in the inspector How to remove the empty string in front and end of the value (Trim)...

Asp.net web form user control with ClientIdMode = “static” cannot be accessed in javascript

asp.net,webforms,user-controls
I have a user control that is used inside an ASP.Net web form page. In the user control I have set the ClientIdMode = "static" e.g <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuestionUserControl.ascx.cs" Inherits="Kids.Math.Presentation.UserControls.QuestionUserControl" ClientIDMode="Static" %> In the form that I am using it I also set Id as: <uc2:QuestionUserControl runat="server" ID="QuestionUserControl1"...

Can I run my web form project from my Android device?

android,webforms
So I have recently made a web form project with visual studio 2013. I would like to run this project directly from my android device. Is that possible? Also, I'm a total newb so please use small workd ;)...

uploading file using ashx filehandler and ajax always return error

jquery,.net,file-upload,webforms,ashx
I am using jquery-file-upload from blueimp (https://blueimp.github.io/jQuery-File-Upload/). I have FileHandler.ashx for file uploads. I am not able to return correct response from file handler. On javascript side, it always receives error. Please, guide me. // File handler (FileHandler.ashx) public void ProcessRequest(HttpContext context) { string fname = String.Empty; if (context.Request.Files.Count >...

Updating Database On CheckBox Check/Uncheck Event

c#,asp.net,checkbox,datagrid,webforms
I am trying to follow This tutorial on updating a database on the check/uncheck event of a check box. However, I am getting a compile error on this line of code Int64 nID = Convert.ToInt64(GridView1.DataKeys[((GridViewRow)chkStatus.NamingContainer).RowIndex].Value); And the compile error is Error 111 'object' does not contain a definition for 'Value'...

Setting Text of Label To Data Retrieved From SQL Database

asp.net,sql-server,webforms,label
I am building a website in ASP.NET Web Forms with a SQL Database. The database contains a table with 571 entry's of data. My problem occurs when outputting the data to the labels. Screenshots below. Database Example Source Code using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString)) { using (SqlCommand command =...

assigning of forms by name dynamically

c#,asp.net,webforms
So what I need is something like this. I want to call the web report form that corresponds to a variable. So for example if the variable value is Test. I want the test.aspx form to be called. I wonder if this is possible, so I don't have to switch...

How do you get values from dynamic controls in a ListView on postback?

c#,asp.net,webforms
I've recently had to go back to dealing with webforms code and have run into an issue trying to update an existing page that shows a list of survey responses. I have a ListView showing details of people who have answered a survey. When you click on an icon in...

How do I convert an existing usercontrol to a Kentico Web Part?

webforms,kentico
I have an existing usercontrol "BigForm.ascx": <%@ Control Language="C#" AutoEventWireup="true" CodeFile="BigForm.ascx.cs" Inherits="BigForm" %> <asp:Panel runat="server" DefaultButton="btnSubmit"> <%--SUPER COMPLICATED FORM--%> <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /> </asp:Panel> BigForm.ascx is very complicated - it dynamically adds subcontrols to placeholders, it encapsulates a whole lot of business logic, the markup is heavily customized,...

telerik:RadMenuItem how to keep hard code Item when bind to datasourse?

c#,asp.net,webforms,telerik
I have telerik:RadMenuItem and I added item using hard code called home. my problem home item show after databind and It will render I item that get it from database just I want to ask how can I keep the home Item <telerik:RadMenu ID="DefaultMenu" runat="server" Flow="Vertical" Skin="LeftSide" EnableEmbeddedSkins="False" OnItemDataBound="DefaultMenu_ItemDataBound" OnItemClick="DefaultMenu_ItemClick">...

Save Modified Repeater (Check Boxes and Text Boxes) to Database

c#,asp.net,webforms,repeater
I have a Repeater that is being bound to some basic database data returned from a query. The Repeater is being bound to the database data after a dropdownlist control's SelectedIndexChanged event fires. Once the event fires and the data is bound, the Repeater is fully populated with the bound...

Call a Javascript function on dropdownlist change

javascript,c#,jquery,asp.net,webforms
I'm using Visual Studio 2013 WebForms, and I'm trying to call a javascript function when a dropdownlist (Asp:DropDownList) is changed. However I am totally confused with this behavior. Could someone please tell me what is wrong? This works <asp:DropDownList ID="ddlList" CssClass="form-control" onchange="alert(1)" runat="server"></asp:DropDownList> But nothing happens with this $(document).ready(function ()...

UpdatePanel AsyncPostbackTrigger not firing

asp.net,ajax,webforms,updatepanel
I've got a little problem, any help is appreciated. Situation looks like this: <asp:UpdatePanel ID="UP_Panel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="ddlSwitch" runat="server" Width="250px" AutoPostback="true" OnSelectedIndexChanged="ddlSwitch_SelectedIndexChanged"> <asp:ListItem Value="continent" Text="Continent"></asp:ListItem> <asp:ListItem Value="region" Text="Region"></asp:ListItem> <asp:ListItem Value="country"...

print a form/panel in asp.net 2013

c#,asp.net,printing,webforms
I have searched for an appropriate answer but can't find any to this question. It is very simple, apart from reports, is there a way I can print a webform i.e send the page design to the printer. If yes, is there also a way to print a selected panel...

How to access GridView ButtonField Control IDs?

c#,asp.net,webforms
I am dealing with a ButtonField column in a GridView, whose RowCommand handler is not triggered in the following lifecycle. This is a common issue around the web and - among others - this SO post helped me understand, that it is caused by differences in the IDs of controls...

Url Routing using ASP.NET

c#,asp.net,webforms
I have: <a href='News.aspx?Id=<%#Eval("Id") %>'>Read more</a> and my querystring is setup like this: SqlConnection con = new SqlConnection(strcon); SqlCommand cmd = new SqlCommand("Select * from Zaebancii where [email protected]", con); SqlDataAdapter apd = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); cmd.Parameters.AddWithValue("@id", Page.Request.QueryString["Id"].ToString()); con.Open(); apd.Fill(ds, "Zaebancii"); cmd.ExecuteNonQuery(); con.Close(); FormView1.DataSource = ds; FormView1.DataBind();...

Using Routing to return a WebForms page

c#,webforms,asp.net-5,asp.net-routing,asp.net-mvc-6
If I have a simple Default.aspx WebForms page under Views/WebForms/Default.aspx, how do I configure the MVC routing to open the Default.aspx page at startup? I've tried reading some articles regarding the MVC 6 routing, but I don't think they're mentioning anything about incorporating WebForms routing with the new MVC 6....

Advice on using web-platform or MVC on a project described above

.net,asp.net-mvc,webforms
our team wants to develop a website. It's kind of a social network for education. We already have a MVP(first prototype). We have 3 programmers who are kind of expert in .net webform, but only one of them knows about MVC. Our MVP is medium in features now and it's...

asp.net change format on various fields with same prefix, different suffix

asp.net,loops,webforms,findcontrol
I have the following VB code in an asp.net page. It works fine, however I am sure there must be a better way (one only line perhaps) to cover all 6 fields within the block. As you can see there are 4 rows of fields, each row contains 6 fields....

second parameter interfering with generic handler

c#,asp.net,parameters,webforms,generic-handler
My problem is this. When I just have a single parameter to search by, my image control works, when I try and pass a second parameter through, the image control does not work. I am using a generic handler as the image.URL, as I want to be able to either...

Required field validator Submit issue

asp.net,validation,webforms,requiredfieldvalidator
I have a web form (say form 1) created for a small dine-in with a submit button. The fields to be validated are Name (textbox) gender(radio button) and so on. below this form on the same page is a feedback form (say form 2) having two fields: name(textbox) and feedback(text...

Dynamically generated Linkbutton does not fire Onclick event VB.Net

asp.net,vb.net,webforms,linkbutton
I have followed some of the instructions to create a new LinkButton at runtime with an event trigger and add an event handler for the LinkButton generated. I have no idea why the new LinkButton does not trigger the event added to it. Anyone please guide/correct me. This is what...

automatic number increase in php based web form [closed]

php,forms,pdf,webforms
So I have created an html form which then posts the results to a php file that overlays them on a PDF and then emails that PDF to myself and the email that was put in the form. All I want to do now is find a simple way to...

WebUserControl changes to Viewstate are not accessible at page level

asp.net,webforms,viewstate
I'm developing an ASP.NET Webforms application and while using the WebUserControl I stumbled upon a behavior I dont understand. My WebUserControl puts 4 strings into the ViewState: var projectCode = SelectedProject.Value; ViewState["ProjectCode"] = projectCode; var resourceId = SelectedResource.Value; ViewState["ResourceCode"] = resourceId; var indicatorId = SelectedIndicator.Value; ViewState["IndicatorCode"] = indicatorId; var areaCode...

Do we need to create Class file for page of website in Asp.net?

c#,asp.net,webforms
I am newbie and learning Asp.net. I am building as web application(admin panel) which will interact with the db. Earlier, when I created web application for assignments, I wrote the code for insert/delete etc in code behind of asp pages either using a sqldatasource or manually writing the code. Now,...

How to highlight selected tab in Web Forms including Master Page

jquery,css,asp.net,webforms,master-pages
I know without a master page it is as simple as setting the tab for each page to selected but how do I do this with master page? Home Page Houses Page (The home tab stays selected even though its on the houses page) Expected Output I used the following...

Nested repeater and datasource

asp.net,webforms
I have a repeater nested in an other repeater. My question is: is it possible to generate other ItemTemplate components with datasource. If yes, how can I do it ? For example: ItemTemplate1 of parentRepeater A B C ItemTemplate2 of parentRepeater D E F It means that ItemTemplate of childRepeater...

preventing cross-site request forgery (csrf) attacks in asp.net web forms

asp.net,webforms,csrf,.net-framework-version
I have created an ASP.Net Web form application usind Visual Studio 2013 and i am using Dot Net Frame Work 4.5, and i want to make sure my site is secure from Cross-Site Request Forgery (CSRF), i have found many articles talking about how this feature is implemented on MVC...

How can i make excel like grid in asp.net C# Webform

asp.net,gridview,datagridview,webforms
How can I make a grid like in Excel in ASP.NET WebForms? I would like rows and coloms where user can enter data and after a click on a save button the data would be inserted into a database....

C# Custom event is always null

c#,asp.net,events,webforms
I know there is some question about this issue on stackOverFlow right now,But none of them solve my problem. I use "asp.net webform" and in my UserControl I want when I hit a Button, fire an event in the page that use this UserControl. so this is my code. //...

Restrict button use on count limit

vb.net,visual-studio-2010,webforms
I want to make a button and then restrict it on the number of clicks So far i have not succeeded but this is how far i came. This is my button <asp:Button ID="btnClearSesson" runat="server" Text="Reset" onclick="btnClearSesson_Click" /> This is what i am doing Protected Sub Page_Load(ByVal sender As Object,...

Populate DropDownList in Column within grid's ItemDataBound event without accessing the database each time

c#,asp.net,webforms,telerik-grid,radgrid
I have a grid in ASP.NET with a column that has DropDownLists in it. Here is an example of what the grid looks like: ItemCol | DropDownCol Item1 | DropDownList Item2 | DropDownList Item3 | DropdownList The only way I know of to populate each DropDownList with its values is...

Pass variables from one page to a webform in drupal

php,drupal,webforms
I'm trying to pass one variable from different product pages to a webform page. Each product page has a session variable like $_SESSION["product_name"] = "Product1";. Similarly, other product pages have $_SESSION["product_name"] = "Product2"; $_SESSION["product_name"] = "Product3"; My question is how to pass these variables to a different webform page. I'm...

Displaying specific information on aspx page using database

c#,asp.net,webforms
I am building a website with ASP.NET Web Forms, and a SQL database. On one particular page I have a number of houses with some informations. There are 571 houses in total. When I click on a particular house, I want to bring up a new page with more information...

Access Login Control from Different Page

c#,asp.net,webforms,forms-authentication
I have a website in C# where users are authenticated to a SQL database via login control. Everything is working fine currently as I'm using the web.config to to direct to the Login.aspx page if the user isn't logged in. What I would like to do though is access the...

Webforms: HttpModule or HttpHandler to save info in the cache

c#,asp.net,webforms,httphandler,httpmodule
I would like to store some information in the cache that I can compare later on with those that the user has typed in. Should I use HttpModule or HttpHandler?? Or is there any better way to do this in WebForms?? I know that in MVC ActionFilters can be used.

ASP.NET Currency regular expression

asp.net,regex,validation,webforms
The currency required format looks like 1,100,258 100,258 23,258 3,258 Or all integers like 123456 or 2421323 and so on. I type below in ValidationExpression (^[0-9]{1,3}(,\d{3})*) | (^[0-9][0-9]*) But it doesn't work....

A easy way to pass parameter back and forth in every page in ASP.NET

c#,asp.net,web-applications,webforms
I want to pass an id back and forth in every page. I can not use session, application variables and database since I want it is base on page. Hidden field if a form exists or url concatenation are what I can think about. Is there an easy way to...

WebForms: Reference dynamic control

c#,asp.net,webforms
I have a WebForms application that generates dynamic select elements on the page. I don't know how many will appear because that is based on how many records are in the database. Here is part of the code that executes on Page_Load. foreach (int studioId in studioIds) { DataRow studio...

what is the best way to display PDF in DIV or panel

html,asp.net,pdf,webforms
What is the best way to show PDF file in DIV. I need to show generated PDF into one of the tab of jquery Accordian tab. Can any one guide what is the best way to move....

HtmlTable loses its HtmlRows while iterating and adding them to a HtmlTable in markup

c#,webforms
I created two HtmlTable(s) in my code-behind whereby each have their own respective HtmlTableRow(s). After I create these, I need to add them to a <table name="teamoptionstable"> element in my markup in a specific order. But while I'm looping to add each HtmlTableRow to my teamoptionstable, the HtmlTable seems to...

Hacking Razor partial views into a WebForms project in MVC5

c#,asp.net,asp.net-mvc,razor,webforms
So, I'm supporting a project made with WebForms, I've upgraded it to MVC5 and want to use Razor views for new features I'm adding. Why I want to do this is because I've no time/will to rewrite all the stuff I got for pure Razor view. There used to be...

How to deploy ASP.NET project?

svn,visual-studio-2013,webforms,windows-server-2008,webdeploy
I've got an ASP.NET Webforms project created in Visual Studio 2013 on my local computer, it's plugged into SVN. I've been asked to find a couple different options for migrating the project to a machine running Windows Server 2008 R2 and deploying it using IIS. So far I've tried following...

Remove certain parts of a webform based on selection from Drop Down List

asp.net,webforms
I want to be able to be able to include and exclude parts of a form based on what type of request the user selects from a drop down list, also included on the form. Here is my current code. I can make the text boxes disappear but I can't...

Asp.net LoginView Rolegroups don't show elements

asp.net,webforms,roles,user-roles,loginview
I'm using rolegroups at my Site.Master masterpage with Web Forms template. When I log in with some admin user, the first page shows the admin role content fine, but when I refresh the page or goes to other page, the elements in Rolegroups disappear. Only the LoggedInTemplate are showed. Someone...

ASP.NET Webforms project is reading from a web.config in a completely different solution on my PC when debugging

c#,vb.net,webforms,web-config
My web app is reading from a web.config from a completely different project with the same name in another solution. How can I check/change what web..config my project is referencing. I want to ensure it is the web.config in the current project.

How to share Master Pages between my projects

c#,asp.net,.net,web,webforms
I'm working on a Web Project and I need to share one master page so that when I create a new page, it has the basic layout. What i've thought is to create a project with that master page and, in each web project, add it as a reference. But...

ASP.NET Web-Form C# Specified cast is not valid

c#,asp.net,sql-server,webforms
I am new to ASP.NET and I'm trying to make a WebShop. The problem is that when I try to execute a method, I get an error. I'm wondering if the problem is in the SQL tables? Here's the method that produces the error public List<Product> productRead(int Product_ID) { IDataReader...

How can I render an entire sitemap in script as a list, reading both title and url?

asp.net,webforms,asp.net-4.0,web.sitemap
My objective is to render the full web.sitemap as a nested unordered list. By full, I mean to produce the entire sitemap from root to all descendants. This list must contain the title and url of each node. This process is useful when your website is a Windows Authenticated network...

How to add value-less HTML5 attributes from code-behind

c#,asp.net,webforms
This is a follow up of this question: How to add <audio> tag to Content of Page in Code behind? Here I am creating an audio control like this. var myAudio = new System.Web.UI.HtmlControls.HtmlAudio(); myAudio.Attributes.Add("autoplay", "autoplay"); myAudio.Attributes.Add("controls", "controls"); myAudio.Src = "test.mp3"; Form.Controls.Add(myAudio); This renders in page as <audio src="test.mp3" autoplay="autoplay"...

How I can resolve a Praser error?

asp.net,webforms
I want to add a class Where is in assembly in my references so I used <%@ page title=" " language="C#" masterpagefile="~/MasterPage.master" autoeventwireup="true" culture="auto" uiculture="auto" Inherits="App_Web_oscnz2mo._Default"meta:resourcekey="PageResource2" enableviewstatemac="false" enableEventValidation="false" viewStateEncryptionMode="Never" %> I have this error`Parser Error Description: An error occurred during the parsing of a resource required to service this request....

How to Use DateTime Web Form Field to Pass DateTime Parameter into Database using Stored Procedure?

c#,asp.net,datetime,webforms,parameter-passing
I am trying to use a datetime field in a webform to pass a datetime parameter into a database. The datetime format in the database is: 2015-05-18 00:00:00.000 The webform input field is: <asp:TextBox ClientIDMode="Static" ID="txtEffDate" runat="server" CssClass="calendarImg" Width="100px"></asp:TextBox> <asp:ImageButton runat="Server" ID="ImageButton1" ImageUrl="~/images/cal.gif" BorderStyle="None" AlternateText="Click to show calendar" TabIndex="300" Style="cursor:...

.asp honeypot for contact form

asp-classic,webforms,honeypot
I'm caught in a hard place where I am being forced to use ASP classic on some web forms. I don't want to get spammed, but I am unaware of how to create a honeypot with .asp classic. Is this possible or will I have to use a captcha field?...

Show more data in each event of DayPilot Lite Calendar - ASP.NET Webforms

asp.net,webforms,calendar,daypilot
In my DayPilot Calendar (Lite) it currently on shows data from one column from the database, which is set to the DataTextField. How do I add more data to each event so the user can look at more data from the database for each event? I currently have this set...

ASp.Net Identity Role manager

asp.net,vb.net,webforms,sql-server-2012,asp.net-identity
I am using Visual Studio 2013. I have a ASP.net (vb) Webforms site with asp.net identity. I trying to create a page that manages User role and create roles. I cant find any help online for this when it comes to web forms. This code works for asp.net membership but...

Issue with String.Format output

asp.net,vb.net,webforms
I am currently trying to display at most 2 decimal places in a smallcurrency field that is being pulled from a SQL database. As you can see in the image below I am using format specifiers to limit the number of decimal places that will be rendered to the controls...

Cannot find InvalidCastException in C# Application

c#,winforms,visual-studio,visual-studio-2012,webforms
I'm getting a strange error in Visual Studio, and of course this great software is unable to tell me where the error is, just that I'm getting an error. I guess the best I can do is paste my code. using (SQLiteCommand cmd = new SQLiteCommand(query, con)) { using (SQLiteDataReader...

SignalR and SqlDependency refreshment issue - ASP.NET

asp.net,webforms,signalr,sqldependency
I have a table in MSSQL database, and I have an ASPX page, I need to push all new rows to the page in a descending order. I found this awesome tutorial which is using SignalR and SqlDependency and it shows only the last row descarding the previous rows which...

how to Use Asp.net Identity with DataBase first approach

c#,entity-framework,webforms,asp.net-identity-2
Hello I am Trying to create Asp.net webforms application with .net 4.5 framework. I have my existing DataBase and I need to work with tha dataBase first approch at the sameTime I need to use ASP.identity. I try to recreate tables which are générated by default with asp.identity In my...

Adding carriage returns to Html control eg) div or span

c#,html,asp.net,webforms,carriage-return
This code ASPX file: Relates to: <div ID="relatedMeasures" runat="server"></div> <br /> Code behind loops through items and appends to a string... foreach (int id in mcsMeasuresSelected) { if (mcs.Id == id) { // Add to selected mcsSelectedMeasures.Add(mcs); output += mcs.Measure + Environment.NewLine; } } relatedMeasures.InnerText = output; Then the output...

How to convert/change data in database temporarily with SQL?

sql,asp.net,sql-server,webforms,daypilot
I am currently making a timetable using the daypilot scheduler. My current start and end data fields are set to the class start period and end period of the timetable, which are just integers from 1 to 9. But because the daypilot scheduler takes the data in a dateTime format,...

ASP.Net validation and javascript for update- and cancel-button

javascript,asp.net,validation,webforms
What I want to do is to display a message during the server roundtrip of an ASP.Net WebForm. On my WebForm I have two buttons e.g. update- and cancel-button. The message should be always displayed if either update- or cancel-button is clicked. If the update-button is clicked there should be...

ASP.NET Web Forms and Identity: Move IdentityModels.cs to another project

c#,asp.net,.net,webforms,asp.net-identity
I'm trying to move IdentityModels.cs to another project to keep the web site apart from the Data Access Layer. I followed this tutorial: http://blog.rebuildall.net/2013/10/22/Moving_ASP_NET_Identity_model_into_another_assembly And also checked this question here: How to move MVC 5 IdentityModels.cs into a separate assembly But I'm still confused because IdentityModels references another class called...

Report Viewer Configuration Error for VS 2012 and IIS 6.0

c#,asp.net,.net,iis,webforms
I want to add some reports in my project and when I am going to show them that time I got following Error The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file. Add to the system.web/httpHandlers section of the web.config file, or add...

What does a ScriptManager script reference do?

javascript,asp.net,webforms,scriptmanager
On a previous project that I was working on, I noticed that the javascript files were included inside the script manager like so: <asp:ScriptReference Path="~/Scripts/jquery-1.7.1.min.js" /> <asp:ScriptReference Path="~/Scripts/site.js" /> I've tried searching as to what the difference between a script reference and a regular <script src="/> is in an asp...

Moving exportPDF function from page to a helper class, replacing 'this'. in ASP.NET C#

c#,asp.net,function,class,webforms
I have an ASP.NET web application in which I created a folder called Code. In this folder is my Basepage.cs. I also added a class called Reporting.cs which will have a static function called ExportReport. When I move the working function from my asp.net page to the Reporting.cs class the...

Converting jpeg to byte[], then inserting into SQL table

c#,sql-server,database,webforms,type-conversion
I'm trying to convert a jpeg that I select from my disk into a byte array, then insert it into a table in SQL Server. I don't receive any errors, the record just isn't inserted... I'm using a webform that allows you to select a Scheme code and Version from...

how to add roles to asp.net when you have webforms

c#,asp.net,webforms
I am beginner in ASP.NET, and I need help to create user roles and identity. Until now, I have create few Webforms (Registration page, Login page...) but I don't know how to manage user roles. I want to bind users with roles, and identities. I saw few examples how to...

Pass data to SQL Server

sql,sql-server,webforms
Aim: to pass data from my Webform to SQL Server using a stored procedure. I believe the code is correct apart from the line for the connectionstring but am unsure what it should be. Issue: passing data from a string to SQL Server via a stored procedure. Specifically the connection...

UseTaskFriendlySynchronizationContext with WebForms and WebAPI in the same project

c#,asp.net,asynchronous,asp.net-web-api,webforms
I have a legacy app that uses WebForms that I need to extend. I incorporated WebAPI for my newer functionality . It all works great until I start using async await. In WebAPI UseTaskFriendlySynchronizationContext = false will cause HttpContext to be null. Setting it to true fixes this issue. In...

Creating Classes from Exising Database

asp.net,vb.net,entity-framework,webforms,sql-server-2012
I have ben following through a tutorial that shows how to get started creating a Web Forms Application in ASP.NET...and have got to the part where you create Data Classes. These assume you are starting from scratch and generating the database from code - however - I already have a...

.net 4.5 web forms c# Context of a variable isn't found in Codefile

.net,webforms,code-behind,saml-2.0
I'm attempting to build a SAML 2.0 Claims aware web form and got some code from MSDN. I understand what the problem is, I just don't know how to solve it: The signedIn variable (and others..) in the cs code behind page doesn't know that it is defined and associated...

Convert Int Value To Bit Value For Grid Display

c#,asp.net,webforms,data-conversion
I am running a sql stored procedure and returning the results to a grid. I want to convert an int column to bit so that it will display in my grid as check boxes as opposed to a 1 or 0 value. I have seen examples of convert to a...

How to postback to a different form using javascript

javascript,c#,jquery,asp.net,webforms
I have a form with a textbox in it, I want to submit the value of the textbox to another page after an ajax call is successfully made, how can I achieve this? This is my ajax method: $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", url: "http://test.net/getData", data: "{some:data}",...

ASP TreeView: All nodes have the same ID

c#,asp.net,webforms,treeview
I'm currently writing a custom web forms control with, among others, an embedded TreeView control. The content of this TreeView control is generated programmatically like this: public void PopulateTreeView(TreeView treeView) { // Initialize with a single root node. treeView.Nodes.Clear(); TreeNode currentNode = new TreeNode("root"); treeView.Nodes.Add(currentNode); // Some logic with basically...

How to style page numbers to not overlap the previous line in custom pager

html,css,asp.net,webforms,pager
I am using a custom pager for some data on a website that I am building. The pager works perfectly but the page numbers overlap each other. I am wondering how could I style them to make them look better. Source Code <ItemTemplate> <asp:LinkButton ID="lnkPage" runat="server" Text='<%#Eval("Text") %>' CommandArgument='<%# Eval("Value")...