473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Accessing ObjectDataSource within Gridview EditItemTemplate

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("clie ntName")))
%>'/>
</ItemTemplate>
<EditItemTemplate>
<!--Projects -->
<asp:ObjectDataSource ID="ProjectData" runat="server"
TypeName="Project"
SelectMethod="GetAllProjects">
</asp:ObjectDataSource>
<asp:DropDownList 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

Jun 29 '06 #1
0 1642

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Anne Catterick | last post by:
Hi, I have an british ASP.Net 2.0 application which is doing what (should) be very simple. But I am having issues. On my page I have a GridView as follows (some tags excluded for easy...
3
by: mthomason | last post by:
I keep getting this error when trying to update records using an ObjectDataSource. I have seen others post similar errors...but I haven't found any solutions. ObjectDataSource...
13
by: anonymike | last post by:
Hello, I started working with the ObjectDataSource today. I have the select, and have been working on getting the update method to work. Here is the asp code for my Data source: ...
0
by: Northern | last post by:
Hello, I have some trouble to declare and instantiate dynamically an ObjectDataSource in the codebehind file. The idea is to bind the objectdatasource to a gridview and have automate sorting and...
0
by: avital | last post by:
Hi, Hope someone can please help. I have a Gridview with a checkboxlist. On edititemTemplate I want the checkboxlist items to be selected as returned from the database. In the database I...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
0
by: aitor.diazdealda | last post by:
I am in a very deep hole and i can not see the light . Here my mistake if you could help me. store procedure.-they work ok. ALTER PROCEDURE dbo.UpdateEtiClientesEtidora ( @CLI_COD_PLAZA...
1
by: HockeyFan | last post by:
protected void gvAuthorizedSigners_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EmptyInsert") { odsAuthorizedSigners.Insert(); return; } if (e.CommandName...
0
by: steve | last post by:
I have been fighting with trying to update a GridView for a while. I don't want to use the "built-in" way to do it because I am using business layer methods for updating and deleteing and I don't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.