Hello...
Anyone pleas help me, i got a problem in Gridview Row Updating...
Server Error in '/Timesheet' Application.
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 160:
Line 161: 'update the timesheet
Line 162: UpdateTimesheet(id, ddlproject.SelectedValue, ddlactivity.SelectedValue, ddlphase.SelectedValue, ddllocation.SelectedValue, ddlbillable.SelectedValue, txtstar.Text, txtend.Text, txtremark.Text, ddlcustomer.SelectedValue)
Line 163:
Line 164: 'Reset Gridview
Source File: D:\Timesheet\Form\TimesheetEntry.aspx.vb Line: 162
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
TimesheetEntry.GridView1_RowUpdating(Object sender, GridViewUpdateEventArgs e) in D:\Timesheet\Form\TimesheetEntry.aspx.vb:162
System.Web.UI.WebControls.GridViewUpdateEventHandler.Invoke(Object sender, GridViewUpdateEventArgs e) +0
System.Web.UI.WebControls.GridView.OnRowUpdating(GridViewUpdateEventArgs e) +133
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +720
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +704
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +123
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Version Information: Microsoft .NET Framework Version:2.0.50727.5456; ASP.NET Version:2.0.50727.5456
This error i find when i use code
'GridView1.EditIndex = -1
it 's for refresh gridview edit index....
I use this code in row updating function...
Dim id As String = GridView1.DataKeys(e.RowIndex).Value.ToString()
Dim row As GridViewRow = GridView1.Rows(e.RowIndex)
Dim txtdate As TextBox = DirectCast(GridView1.Rows(e.RowIndex).FindControl("txtdate"), TextBox)
Dim ddlproject As DropDownList = DirectCast(GridView1.Rows(e.RowIndex).FindControl("ddlproject"), DropDownList)
Dim ddlactivity As DropDownList = DirectCast(GridView1.Rows(e.RowIndex).FindControl("ddlactivity"), DropDownList)
Dim ddlphase As DropDownList = DirectCast(GridView1.Rows(e.RowIndex).FindControl("ddlphase"), DropDownList)
Dim ddllocation As DropDownList = DirectCast(GridView1.Rows(e.RowIndex).FindControl("ddllocation"), DropDownList)
Dim ddlbillable As DropDownList = DirectCast(GridView1.Rows(e.RowIndex).FindControl("ddlbillable"), DropDownList)
Dim txtstar As TextBox = DirectCast(GridView1.Rows(e.RowIndex).FindControl("txtstar"), TextBox)
Dim txtend As TextBox = DirectCast(GridView1.Rows(e.RowIndex).FindControl("txtend"), TextBox)
Dim txtremark As TextBox = DirectCast(GridView1.Rows(e.RowIndex).FindControl("txtremark"), TextBox)
Dim ddlcustomer As DropDownList = DirectCast(GridView1.Rows(e.RowIndex).FindControl("ddlcustomer"), DropDownList)
UpdateTimesheet(id, ddlproject.SelectedValue, ddlactivity.SelectedValue, ddlphase.SelectedValue, ddllocation.SelectedValue, ddlbillable.SelectedValue, txtstar.Text, txtend.Text, txtremark.Text, ddlcustomer.SelectedValue)
bindData3(Label19.Text)
I hope anyone help me...
Thank's....