using elements at the codeBehind

  • Thread starter Thread starter Mr. X.
  • Start date Start date
M

Mr. X.

Helo,
I am using VS 2008, and asp.net.

Not all the elements can be referenced by the default.aspx.vb
(such as the following code, with btn_save, even I set the id="btn_save")
What to do in order to solve the above ?

Thanks :)

The code :
========================
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb"
Inherits="WebApplication3._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="right" dir="rtl">
<asp:Button ID="btn_save" runat="server" Text="ùîåø" Width="120px"
/>
</div>
</form>
</body>
</html>
 
First, make sure that the default.aspx.designer.vb file was correctly
regenerated (make sure it contains a declaration for btn_save), sometimes
Visual Studio doesn't regenerate this file automatically. To have it
regenerated, try switching between design and source view or just remove and
readd the button, or you can manually add it to the designer file and then
just let Visual Studio overwrite your manual adding the next time it
generates the file. What code are you using to reference the button, and
from which event handler (you may want to post this as well)?
 
Make sure you save the file before playing with code behind, as the sync is
not always perfect. If you are hand coding, you might end up closing the
page before you are golden.

The best way to do this is drag and drop, as it covers all of the wiring for
you in a nice way. Just drag from toolbox to the form

To create a handler, just double click on the control. You can also wire
through the tagged page or with the Handles key word.

--
Gregory A. Beamer
MVP; MCP: +I, Se, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

*************************************************
| Think outside the box! |
*************************************************
 
Back
Top