CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_web_developer_2005_express Tags:
Item Type: NewsGroup Date Entered: 1/18/2007 2:42:13 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 26 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
bslim67
Asp.Net User
lblEditMsg does not exist in the current context1/18/2007 2:42:13 AM

0/0

Hi all,

My asp code and C# code are separated.

And I had created a new label lblEditMsg in the asp code

<

form id="form1" runat="server" >

<div>

<asp:Label id="lblEditMsg" EnableViewState="True" ForeColor="Red" Runat="Server" style="left: 14px; position: absolute; top: 303px"/>

And on the GridView, I had put in a method Edit_Row

<asp:GridView ID="GridView1" OnRowEditing="Edit_Row" ................

 

But when I tried to code the lblEditMsg on the Edit_Row method, it says "lblEditMsg does not exist in the current context"

public void Edit_Row(object sender, GridViewEditEventArgs e)

{

 

lblEditMsg.Text =

"Row " + e.NewEditIndex + 1 + " being edited";

}

Even if I rebuild the website, the problem still exists.

Can someone please help?

Thanks 

 

ecbruck
Asp.Net User
Re: lblEditMsg does not exist in the current context1/18/2007 4:21:21 PM

0/0

I'm not sure what your problem is. I've included a similar example that works just fine. If I were you, I'd strip down the page to the bare basics to isolate the problem or start a fresh page.

ASPX 

<div style="margin-bottom: 20px;">
	<asp:label id="lblEditMsg" runat="server" />
</div>
<asp:gridview id="gvProducts" runat="server" allowpaging="True" autogenerateeditbutton="true"
	datakeynames="ProductID" datasourceid="sdsProducts" onrowediting="gvProducts_RowEditing" onrowcancelingedit="gvProducts_RowCancelingEdit">
</asp:gridview>
<asp:sqldatasource id="sdsProducts" runat="server" connectionstring="<%$ ConnectionStrings:NorthwindConnectionString %>"
	selectcommand="SELECT * FROM [Products]">
</asp:sqldatasource>

CODE-BEHIND 

protected void gvProducts_RowEditing(object sender, GridViewEditEventArgs e)
{
	lblEditMsg.Text = String.Format("Row {0} being edited", e.NewEditIndex + 1);
	lblEditMsg.Visible = true;
}

protected void gvProducts_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
	lblEditMsg.Visible = false;
}


Thanks, Ed

Microsoft MVP - ASP/ASP.NET

Please remember to 'Mark as Answer' if this post answered your question!
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:





Search This Site:










vwd question

sql server 2005 express and microsoft access

exception from hresult: 0x8007000b

prebuild compiled page

installation problem

can we delete the partial class generated by dotnetframework

how can i find "add new provider"?????

ul on one line

how to add crystal report viewer?

how can display underline of text in button when mouse hover?

problems with the new beta2 version of the .net framework

retrieving a single value from a sql query

tab order question

vwd and crystal reports 9

vwd editing problems

vwd compilation error

missing treeview control in feb ctp?

literal and placeholder controls.

problem with setup visual studio 2005

using reportview with vwd 2005 express

beta expiration

installation error

many bug with the personal web site starter kit

where to find the event setting in vwd

strange behaviour !!!

asp.net and adodb (general question)

download visual web developer 2005 as setup file

server error in '/' application. invalid xml. missing required tag <codegroup> for type 'system.security.policy.policylevel'.

change language from vb to c#

record a link click

  Privacy | Contact Us
All Times Are GMT