aspx-user-control

How can I add a code-behind file to an aspx page?

梦想与她 提交于 2019-12-12 06:06:41
问题 There are two pages in a legacy app to which I'm addding fuctionality. One of the .aspx files, when the "Design" view is shown, sports an Events tab in the Properties pane: The other, though, does not - it only shows Properties: I need to add a custom method to this code; how can I create a corresponding .vb code-behind file where I can add this method? UPDATE I tried jackjop's suggestions, but F7 did nothing, and I do not seem to have the "Show All Files" glyph: UPDATE 2 I tried adding this

Using c# in Web Forms to passing parameter to user control

你说的曾经没有我的故事 提交于 2019-12-11 18:00:59
问题 From an aspx page, I am trying to display a user control for each item in a collection, but the C# seems to be ignored when tryign to set the UserControl parameter: <%foreach (Fetus item in this.pregnancy.Fetus) {%> //this returns a GUID: "<%= item.Id.ToString() %>" //this does not work, returns the characters between "" like < %= item.Id.ToString()%>: <uc1:AntepartumCTGChart runat="server" ID="AntepartumCTGChart" FetusId="<%= item.Id.ToString()%>" /> <% } %> I would expect this to work, what

How to use web handlers for PDF creation?

情到浓时终转凉″ 提交于 2019-12-05 05:11:16
问题 I have pretty less knowledge in web handlers. All I know is web handlers are used for creating some dynamic file creation purpose. And also I know how to add the Web handlers. But, I need to use web handlers in my ASP.NET project for PDF creation purpose. 回答1: You can have a HTTP handler to serve out your PDFs like this: public void ProcessRequest (HttpContext context) { // Get your file as byte[] string filename = "....file name."; byte[] data = get your PDF file content here; context

Can't access control ID in code behind

▼魔方 西西 提交于 2019-11-30 05:52:15
问题 I have the following code in my aspx page: <asp:Button runat="server" ID="myButton" Text="hello" /> and this in my code behind: protected void Page_Load(object sender, EventArgs e) { myButton.Text = "bye"; } For some reason the intellisense picks up the "myButton" id in the code behind but when it compiles it says it can't build because it doesn't recognise it! My page is a default aspx page which uses a master page, the button is inside a content control and all is set to run at server

Can't access control ID in code behind

人盡茶涼 提交于 2019-11-27 21:16:30
I have the following code in my aspx page: <asp:Button runat="server" ID="myButton" Text="hello" /> and this in my code behind: protected void Page_Load(object sender, EventArgs e) { myButton.Text = "bye"; } For some reason the intellisense picks up the "myButton" id in the code behind but when it compiles it says it can't build because it doesn't recognise it! My page is a default aspx page which uses a master page, the button is inside a content control and all is set to run at server correctly, the page runs and displays fine except for this button resolution issue! Any ideas? Sounds like