I am an old ASP programmer that recently took a job that has ASP.NET. I have an aspx file that has this at the top:
<%# Page Title="" Language="C#" MasterPageFile="~/Default.Master" AutoEventWireup="true"
CodeBehind="List.aspx.cs" Inherits="itnola.List" %>
And the area that I'm most interested in is this line of code:
<asp:DropDownList ID="dplDistrict" runat="server" Width="205" DataValueField="districtID"
DataTextField="districtname">
There is a table in the database called districts that if I make a modification to that table it displays the changes in this dropdown. However, there is an extra entry in the drop down I assume they have hardcoded.
Not being familiar with ASP.NET, I've looked for a List.aspx.cs file and do not find it anywhere on the server. I did find an itnola.dll file in a bin folder I suspect may have something to do with this. If I remember correctly from my Visual Basic days this dll file is "compiled" and therefore not editable correct? How do I remove this one line in the drop down?
Related
I have several user controls that look like this:
<%# Control Language="vb" AutoEventWireup="false"
Inherits="classname"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"
Codebehind="classname.ascx.vb"
%>
I know that TargetSchema was supposed to give Visual Studio help with Intellisense when working with asp/html pages. Does it still do anything or is it just ignored? I don't see any obvious difference, and of course the version number is way out of date, but if it's still doing something useful, I wouldn't want to just delete it willy-nilly.
I'm trying to clean up a registration form. The precursors made it easy to adjust most sections of this form, but when I get to the Address portion of the template I uncovered this strange artifact:
<table>
<tr>
<td>
<asp:PlaceHolder ID="phAddress" runat="server"></asp:PlaceHolder>
</td>
</tr>
</table>
The directory system for this site is extensive but I've had luck tracking stuff using text searches of file content. However, with this one searching for "phAddress" gets me nowhere.
=================================================
=================================================
Press CTRL + SHIFT + F and search for the text phAddress with the option selected as "Entire Solution".
As its "PlaceHolder" there is a possibility that "dynamic controls" are added from the "codebehind(aspx.cs or aspx.vb)" page.
Without seeing more of your code base, it's almost impossible to figure out what's being done. Typically, a PlaceHolder is just that - a placeholder for controls that are going to be generated dynamically server-side. Try doing a Ctrl+F for "phAddress" in the codebehind file. If you don't know what that is, take a look at the very top of the asp file, you should see something like this:
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
CodeBehind="mypage.aspx.cs" Inherits="myprogject.mypage" %>
CodeBehind is the class name, and Inherits= is the directory path of where it lives.
In VS 2010, here's what you're looking for:
This is a C# file, but the structure for VB should be same.
I have Website project, which contains some .ascx and .aspx files. I have added new element <asp:TextBox ID="tb1" runat="server" ... /> in .ascx file and I have wrote some code in proper .ascx.cs file using this element: tb1.Text = "SomeText";. When I compile this project I recieve following error: The name 'tb1' does not exist in the current context.
How can I force to refresh markup of .ascx page? I use Website project and I cannot to change its type to Webapplication.
UPD: I have Website project, which has NOT .ascx.designers.cs files. And I cannot change type of my project to web application.
Unless there's something else happening here, it sounds like the designer.cs file might be out of sync. Try cutting and pasting the control back into the markup, or go into the designer file for the user control and add the TextBox manually:
protected global::System.Web.UI.WebControls.TextBox tb1;
It seems like your design file is not connecting with your code behind file.
Can you confirm if you are defining it as follows,
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="yourcontrol.ascx.cs" Inherits="CompleteNameSpace.ClassName" %>
I'm the newly appointed tech-guy at a small company. I've inherited their near-complete ASP.NET web page that's been left "near-complete" for some time, but I'm not really familiar with ASP.NET. It was dropped by the original developers a few years ago, and a year or so back someone tried to finish it using only inline code.
Now that I've unearthed the old VB source files, I've made a one-line change to the Page.aspx.vb and need get it associated to it's Page.aspx file. Trouble is, the #Page directive directly inherits its own App_Web_Page.xxxxxx.dll. Every page does this. This is not reflected in the source I have to work with, but is the way it now operates. The last person to touch it has long since forgotten the details of his work, and I'm not familiar enough with ASP.NET to know what to ask.
So my #Page directive goes like so:
<%# page language="vb" autoeventwireup="false" inherits="Page,
App_Web_page.aspx.cdcab7d2" masterpagefile="~/Master.Master"
enablesessionstate="True" enableEventValidation="false" %>
When I try to precompile the site, my #Page directives look totally different:
<%# page language="vb" autoeventwireup="false" Codebehind="Page.aspx.vb"
inherits="Project.Page" masterpagefile="~/Master.Master"
enablesessionstate="True" enableEventValidation="false" %>
And, being precompiled, It doesn't yield a page-unique .dll file I can just swap into the live bin directory and change the #Page directive for. I've tried a number of permutations on the #Page directive to try to get it to compile the new VB code on access, but I always wind up with errors, the best of which tell me ASP elements in the .aspx aren't defined in the .aspx.vb.
Can someone point me in the right direction with this?
You have to select the option like below highlighted...
I'm trying to create a user control and reference it on an aspx page. It works, but only if I reference the individual control, like this:
<%# Register TagPrefix="schmapp" TagName="TestControl" Src="~/TestControl.ascx" %>
instead of referencing the whole namespace, like this:
<%# Register Assembly="UserControlTest" Namespace="UserControlTest" TagPrefix="app" %> <!-- doesn't work-->
I've done this many times yet it's been a while so I might be forgetting something basic. I refreshed my memory with a few tutorials and I think I'm doing the same steps.
I had this in the project I'm working on (.NET 3.5 under VS 2008) and I reproduced it step by step in a very basic project (.NET 4 under VS 2010) - I uploaded it for reference purposes.
I create a new asp.net web project, then Add -> New Item -> Web User Control, and then type some text into the ascx file (just to check if the control is being rendered). I then register the control and try to add it on the page. It works if it's referenced by Src attribute:
<schmapp:TestControl runat="server"/>
but not if the whole assembly is being referenced:
<app:TestControl runat="server" />
Now I can list the controls one by one but it's ugly and I don't want to accept defeat by something so simple, so I summon the might powers of teh internets to help.