Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

This is the first time i am using this forum,

 

I have an asp application which has datagrid, i am trying to insert dropdownlist inside the rnrdatagrid1 using web matrix

 

now i have delared the strRnrABC as string before the pageload and rnrLblAbc is the Label ID in Datagrid.

 

when i bind the grid its coming right but when i click on the edit link that is OnEditCommand="dtgDataGrid1_Edit"

 

'--------------------------------------

Public Sub dtgDataGrid1_Edit(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)

strRnrAbc = CType(E.Item.FindControl("rnrLblAbc"), Label).Text

rnrDatagrid1.EditItemIndex = CInt(E.Item.ItemIndex)

Binddata()

End Sub

 

'--------------------------------------

 

 

i Get the following error :

 

 

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

 

Source Error:

 

 

Line 366:

Line 367: Public Sub dtgDataGrid1_Edit(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)

Line 368: strRnrAbc = CType(E.Item.FindControl("rnrLblAbc"), Label).Text

Line 369: rnrDatagrid1.EditItemIndex = CInt(E.Item.ItemIndex)

Line 370: Binddata()

 

 

Source File: C:\Inetpub\wwwroot\tipsmaster\tipsmaster_app.aspx Line: 368

 

Stack Trace:

 

 

[NullReferenceException: Object reference not set to an instance of an object.]

ASP.tipsmaster_app_aspx.dtgDataGrid1_Edit(Object Sender, DataGridCommandEventArgs E) in C:\Inetpub\wwwroot\tipsmaster\tipsmaster_app.aspx:368

System.Web.UI.WebControls.DataGrid.OnEditCommand(DataGridCommandEventArgs e) +110

System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e) +666

System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26

System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e) +100

System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26

System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +120

System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +115

System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18

System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138

System.Web.UI.Page.ProcessRequestMain() +1263

 

 

Thanks in advance

 

one more thing how can we declared withevents in web matrix ??

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...