D
Dom
Hello
This should work I know ... but.. with your help perhaps..
Trying to assign a 'selectparameter' to an objectdatasource nested
within a gridview EditItemTemplate.
When I try to access access the object in the OnRowDataBound event am
getting a null
However am able to access the object in the OnRowUpdating event.
Would appreciate any guidance... Code below.
ASPX
asp:GridView Width="100%" ID="clientTasksGrid" runat="server"
AutoGenerateColumns="False"
DataKeyNames="clientTaskId, clientId" DataSourceID="IssueDS"
AllowSorting="True" CellPadding="4"
AllowPaging="True" PageSize="15" GridLines="None"
HeaderStyle-HorizontalAlign="left"
OnRowUpdating="GridView_RowUpdating="
OnRowDataBound="GridView_RowDataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label Font-Bold="true" ID="clientLabel" runat="server"
Text='<"%# HttpUtility.HtmlEncode(Convert.ToString(Eval("clientName")))
%>'/>
</ItemTemplate>
<EditItemTemplate>
<!--Projects -->
<asp:ObjectDataSource ID="ProjectData" runat="server"
TypeName="Project"
SelectMethod="GetAllProjects">
</asp:ObjectDataSource>
<asp
ropDownList ID="ProjectList" runat="server" AutoPostBack="True"
CssClass="ProjectCategories"
DataSourceID="ProjectData" DataTextField="Name" DataValueField="Id"
/>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void GridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// ObjectDataSource tempProjectDataSource =
(ObjectDataSource)row.FindControl("ProjectData");
}
}
Thank you for your assistance
This should work I know ... but.. with your help perhaps..
Trying to assign a 'selectparameter' to an objectdatasource nested
within a gridview EditItemTemplate.
When I try to access access the object in the OnRowDataBound event am
getting a null
However am able to access the object in the OnRowUpdating event.
Would appreciate any guidance... Code below.
ASPX
asp:GridView Width="100%" ID="clientTasksGrid" runat="server"
AutoGenerateColumns="False"
DataKeyNames="clientTaskId, clientId" DataSourceID="IssueDS"
AllowSorting="True" CellPadding="4"
AllowPaging="True" PageSize="15" GridLines="None"
HeaderStyle-HorizontalAlign="left"
OnRowUpdating="GridView_RowUpdating="
OnRowDataBound="GridView_RowDataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label Font-Bold="true" ID="clientLabel" runat="server"
Text='<"%# HttpUtility.HtmlEncode(Convert.ToString(Eval("clientName")))
%>'/>
</ItemTemplate>
<EditItemTemplate>
<!--Projects -->
<asp:ObjectDataSource ID="ProjectData" runat="server"
TypeName="Project"
SelectMethod="GetAllProjects">
</asp:ObjectDataSource>
<asp
CssClass="ProjectCategories"
DataSourceID="ProjectData" DataTextField="Name" DataValueField="Id"
/>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void GridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// ObjectDataSource tempProjectDataSource =
(ObjectDataSource)row.FindControl("ProjectData");
}
}
Thank you for your assistance