Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview?
Go Back  Xtreme Visual Basic Talk > > > Retrieve values using emptydatatemplate in detailsview?


Reply
 
Thread Tools Display Modes
  #1  
Old 12-06-2007, 11:19 AM
r_nair83 r_nair83 is offline
Regular
 
Join Date: May 2006
Posts: 67
Default Retrieve values using emptydatatemplate in detailsview?


hi,
I am using emptydatatemplate control of GridView.Inside gridview's emptydatatemplate i am using detailsview.I would like to know how to retrieve value of textbox field.I tried using findcontol but could not find a solution.I am getting an error.Object reference not set to an instance.
Following is my code.
Code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
            <Columns>
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:CommandField ShowEditButton="True" />
            </Columns>
            
            <EmptyDataTemplate>
            <asp:DetailsView ID="detailsview1" runat="server" OnItemInserting="DetailsView1_ItemInserting"  AutoGenerateInsertButton="true"  DefaultMode="Insert">
            <Fields>
            <asp:TemplateField HeaderText="Address">
            <InsertItemTemplate>
            <asp:TextBox ID="txtadd" runat="server"></asp:TextBox>
            </InsertItemTemplate>
            </asp:TemplateField>
            </Fields>
            </asp:DetailsView>
            </EmptyDataTemplate>
        </asp:GridView>
Plz help me with an appropriate solution..

Thanks.....
Reply With Quote
  #2  
Old 12-07-2007, 07:57 AM
mcdonnc2004's Avatar
mcdonnc2004 mcdonnc2004 is offline
Junior Contributor
 
Join Date: Dec 2003
Location: Liverpool, UK
Posts: 276
Default

Hi,

Check out these links with tonnes of info on the FindControl method:

http://forums.asp.net/ThreadNavigati...1&NavType=Next
http://forums.asp.net/p/946380/1239675.aspx
http://www.codeproject.com/dotnet/Ac...lsInsideGr.asp
http://www.codeproject.com/aspnet/Gr...deGridView.asp
http://forums.asp.net/t/998368.aspx

The reason I provided those links is so you could see that the FindControl method only works at the naming container level, and can be particularly tricky with a GridView. The fact that you have a DetailsView nested inside the GridView adds more complexity to it!

Is there a special reason why you have to use a DetailsView inside the GridView and also what event (be it a button click or databinding) are you trying to get the value of the textbox? I ask the latter because if it is a databinding event on the GridView you can usually use the sender argument in the FindControl method to retrieve the control.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview? Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview?
 
Retrieve values using emptydatatemplate in detailsview?
Retrieve values using emptydatatemplate in detailsview?
 
-->