shahab
Junior Contributor
I have a DataGrid(Pagable one) that there is a dropdownlist in it.Ok
Scenario : When ever the dropdownlist value selected specia operation must happen.
Problem : in newPageIndexes i recieve this error :
Q1-Is it true to using DataGrid1_ItemCommand for :
if (((DropDownList)e.Item.FindControl("DropDownList1")).SelectedValue == "edit") ???
*****************************************************
Q2-The DataGrid1_PageIndexChanged is this:
Is that enough? :-\
*******************************************************
Q3-What about the error?(Object not set ...)
Help me!
[edit]Changed PHP tags to CS tags:Robby[/edit]
Scenario : When ever the dropdownlist value selected specia operation must happen.
Problem : in newPageIndexes i recieve this error :
C#:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 174: if (((DropDownList)e.Item.FindControl("DropDownList1")).SelectedValue == "edit")
Line 175: {
Line 176: Response.Redirect("EditNews.aspx");
if (((DropDownList)e.Item.FindControl("DropDownList1")).SelectedValue == "edit") ???
*****************************************************
Q2-The DataGrid1_PageIndexChanged is this:
C#:
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
bindGrid1();
/*try
{
if ((DataGrid1.PageCount - e.NewPageIndex) > 0)
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
//Session["NewsId"]=DataGrid1.DataKeys[0];
bindGrid1();
}
}
catch (Exception e01)
{
Label3.Text = e01.Message.ToString();
}*/
}
*******************************************************
Q3-What about the error?(Object not set ...)
Help me!
[edit]Changed PHP tags to CS tags:Robby[/edit]
Last edited by a moderator: