Click here to Skip to main content
15,922,584 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: only first row from datareader gets affected Pin
Christian Graus14-May-09 3:01
protectorChristian Graus14-May-09 3:01 
GeneralBasic Photography Web Site (PLZ H3LP IRGint!!!) Pin
Brady Kelly14-May-09 0:59
Brady Kelly14-May-09 0:59 
GeneralRe: Basic Photography Web Site (PLZ H3LP IRGint!!!) Pin
Christian Graus14-May-09 1:09
protectorChristian Graus14-May-09 1:09 
GeneralCheckout XARA Pin
David Mujica14-May-09 3:31
David Mujica14-May-09 3:31 
Questiontable inside a href=".." Question? Pin
mrcooll14-May-09 0:59
mrcooll14-May-09 0:59 
AnswerRe: table inside a href=".." Question? Pin
jbracken197314-May-09 2:05
jbracken197314-May-09 2:05 
AnswerRe: table inside a href=".." Question? Pin
Samer Aburabie14-May-09 2:10
Samer Aburabie14-May-09 2:10 
QuestionProblem while binding data to a DropDownList in GridView's EditItemTemplate column Pin
YazhiniP14-May-09 0:32
YazhiniP14-May-09 0:32 
Hi,
I am a beginner in .NET.
I Placed a DropDownList in GridView's EditItemTemplate field.
Whenever i click the Edit Button i am getting a runtime error stating
"object Reference not set to an instance of the object".
That is,when i try to find the DropDownList using FindControl method,it is always null.
I have tried a lot of code in both GridView's RowBound and RowEditing events.
But,all the time i am getting the same error.
Below i have given the code that i tried in RowEditing event.
It will be very helpful if anyone help me in resolving this error.

.aspx source code



<asp:gridview id="gvDocumentDetails" runat="server" autogeneratecolumns="false" width="97%" autogenerateeditbutton="true"

="" ondatabinding="gvDocumentDetails_DataBinding" onrowediting="gvDocumentDetails_RowEditing" onrowupdating="gvDocumentDetails_RowUpdating" onrowdatabound="gvDocumentDetails_RowDataBound">

<columns>

<asp:boundfield headertext="Incident ID" datafield="Incident_ID">

<asp:boundfield headertext="Application" datafield="Application">

<asp:boundfield headertext="Type" datafield="Type">

<asp:boundfield headertext="Document Details" datafield="Document_Details">

<asp:boundfield headertext="Uploaded Date" datafield="Uploaded_Date">

<asp:templatefield headertext="Approval Status">

<itemtemplate>

<asp:label id="lblDocumentStatus" runat="server" text="<%#" eval("approval_status")="" %="">/>



<edititemtemplate>

<asp:dropdownlist id="ddlApprovalStatus" runat="server" datatextfield="Approval_Status" datavaluefield="Approval_Status_ID">











.cs file



protected void gvDocumentDetails_RowEditing(object sender, GridViewEditEventArgs e)

{



int intEditIndex;

intEditIndex = e.NewEditIndex;

gvDocumentDetails.EditIndex = e.NewEditIndex;

PopulateApprovalStatus(intEditIndex);

}

protected void PopulateApprovalStatus(int intRowIndex)

{

DataSet dsApprovalStatus = new DataSet();

DropDownList ddlApprovalStatus = null;

ObjReviewDocumentsBL.LoadApprovalStatus(out dsApprovalStatus);

ddlApprovalStatus = (DropDownList)gvDocumentDetails.Rows[intRowIndex].Cells[6].FindControl("ddlApprovalStatus");

ddlApprovalStatus.DataSource = dsApprovalStatus;

ddlApprovalStatus.DataBind();

}

I have checked the "dsApprovalStatus" dataset while debugging,and it has been filled by the LoadApprovalStatus() function.But, i m getting error in the following line.

ddlApprovalStatus.DataSource = dsApprovalStatus;

And ddlApprovalStatus value is null.

Thanks in advance...

Yazhini

AnswerRe: Problem while binding data to a DropDownList in GridView's EditItemTemplate column Pin
Samer Aburabie14-May-09 2:23
Samer Aburabie14-May-09 2:23 
GeneralRe: Problem while binding data to a DropDownList in GridView's EditItemTemplate column Pin
YazhiniP15-May-09 0:02
YazhiniP15-May-09 0:02 
Questioncoding for scanner in aspx page Pin
rummer14-May-09 0:02
rummer14-May-09 0:02 
AnswerRe: coding for scanner in aspx page Pin
Paddy Boyd14-May-09 0:09
Paddy Boyd14-May-09 0:09 
GeneralRe: coding for scanner in aspx page Pin
rummer14-May-09 0:18
rummer14-May-09 0:18 
GeneralRe: coding for scanner in aspx page Pin
Paddy Boyd14-May-09 0:26
Paddy Boyd14-May-09 0:26 
GeneralRe: coding for scanner in aspx page Pin
rummer14-May-09 0:32
rummer14-May-09 0:32 
GeneralRe: coding for scanner in aspx page Pin
rummer14-May-09 0:52
rummer14-May-09 0:52 
GeneralRe: coding for scanner in aspx page Pin
rummer14-May-09 0:57
rummer14-May-09 0:57 
GeneralRe: coding for scanner in aspx page Pin
Christian Graus14-May-09 1:13
protectorChristian Graus14-May-09 1:13 
GeneralRe: coding for scanner in aspx page Pin
rummer14-May-09 0:29
rummer14-May-09 0:29 
GeneralRe: coding for scanner in aspx page Pin
Christian Graus14-May-09 1:12
protectorChristian Graus14-May-09 1:12 
GeneralRe: coding for scanner in aspx page Pin
Eytukan15-May-09 19:07
Eytukan15-May-09 19:07 
GeneralRe: coding for scanner in aspx page Pin
Yusuf14-May-09 1:15
Yusuf14-May-09 1:15 
GeneralRe: coding for scanner in aspx page Pin
rummer14-May-09 1:25
rummer14-May-09 1:25 
GeneralRe: coding for scanner in aspx page Pin
Christian Graus14-May-09 1:28
protectorChristian Graus14-May-09 1:28 
GeneralRe: coding for scanner in aspx page Pin
rummer14-May-09 1:34
rummer14-May-09 1:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.