NickMalloy
asked on
e.row.dataitem is null
I am trying to do some code in my rowevent for a gridview, but I keep getting null values and I can't figure out what I am missing?? Here is my code
<asp:GridView ID="GridView2" AllowPaging="True" AllowSorting="true" DataSourceID="EntityDataSo urce1"
Width="100%" Font-Size="X-Small" AutoGenerateColumns="false "
runat="server" DataKeyNames="AskQuestionI D" OnPageIndexChanging="GridV iew2_PageI ndexChangi ng"
OnRowUpdating="GridView2_R owUpdating " OnRowCommand="GridView2_Ro wCommand" OnRowEditing="GridView2_Ro wEditing"
GridLines="None" OnRowUpdated="GridView2_Ro wUpdated" OnRowCancelingEdit="GridVi ew2_Cancel ingEdit"
OnRowDataBound="GridView2_ RowDataBou nd" OnRowDeleting="GridView2_R owDeleting "
OnRowDeleted="GridView2_Ro wDeleted" OnSorting="GridView2_Sorti ng">
<RowStyle BackColor="Gainsboro" />
<AlternatingRowStyle BackColor="#cccccc" />
<Columns>
<asp:TemplateField HeaderText="Question ID" SortExpression="AskQuestio nID">
<ItemTemplate>
<asp:Label ID="lblOrderID" Text='<%# Eval("AskQuestionID") %>' runat="server"></asp:Label >
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="View Record">
<ItemTemplate>
<asp:LinkButton ID="ReassignButton" runat="server" CommandName="ViewAs" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
Text="View Record" />
<br />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:EntityDataSource ID="EntityDataSource1" runat="server"
ConnectionString="name=MyQ Entities" DefaultContainerName="MyQE ntities"
EnableDelete="True" EnableFlattening="False" EntitySetName="vw_NestedUI ">
</asp:EntityDataSource>
protected void GridView2_RowDataBound(obj ect sender, GridViewRowEventArgs e)
{
//Check if this is our Blank Row being databound, if so make the row invisible
if (e.Row.RowType == DataControlRowType.DataRow )
{
ICustomTypeDescriptor descriptor = e.Row.DataItem as ICustomTypeDescriptor;
if (null != descriptor)
{
}
}
<asp:GridView ID="GridView2" AllowPaging="True" AllowSorting="true" DataSourceID="EntityDataSo
Width="100%" Font-Size="X-Small" AutoGenerateColumns="false
runat="server" DataKeyNames="AskQuestionI
OnRowUpdating="GridView2_R
GridLines="None" OnRowUpdated="GridView2_Ro
OnRowDataBound="GridView2_
OnRowDeleted="GridView2_Ro
<RowStyle BackColor="Gainsboro" />
<AlternatingRowStyle BackColor="#cccccc" />
<Columns>
<asp:TemplateField HeaderText="Question ID" SortExpression="AskQuestio
<ItemTemplate>
<asp:Label ID="lblOrderID" Text='<%# Eval("AskQuestionID") %>' runat="server"></asp:Label
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="View Record">
<ItemTemplate>
<asp:LinkButton ID="ReassignButton" runat="server" CommandName="ViewAs" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
Text="View Record" />
<br />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:EntityDataSource ID="EntityDataSource1" runat="server"
ConnectionString="name=MyQ
EnableDelete="True" EnableFlattening="False" EntitySetName="vw_NestedUI
</asp:EntityDataSource>
protected void GridView2_RowDataBound(obj
{
//Check if this is our Blank Row being databound, if so make the row invisible
if (e.Row.RowType == DataControlRowType.DataRow
{
ICustomTypeDescriptor descriptor = e.Row.DataItem as ICustomTypeDescriptor;
if (null != descriptor)
{
}
}
There's a } missing, or is that just a cut and paste error.
ASKER
cut paste error.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.