Subscribe to Subscribers
Talk to Webmaster Tony John

Online Members

Phagu Mahato
More...


Forums » .NET » ASP.NET »

Problem obtain detailsview control value


Posted Date: 14 Nov 2011      Posted By:: jassie     Member Level: Bronze    Member Rank: 3141     Points: 5   Responses: 1



<%@ Page Language="C#" MasterPageFile="~/RpApp.Master" AutoEventWireup="true"
CodeBehind="Detail.aspx.cs" Inherits="Support.Att_Detail" %>



<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="Support.AttDataContext"
Select="new (Att_id, Prior_Cutoff_Date)"
TableName="Attestations" Where="Att_id == @Attid">
<WhereParameters>
<asp:SessionParameter Name="Att_id" SessionField="AttID" Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>

<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" EnableModelValidation="True"
AutoGenerateRows="False" DataSourceID="LinqDataSource1" BorderStyle="Solid" HorizontalAlign="Center">
<Fields>
<asp:TemplateField HeaderText="Att ID">
<ItemTemplate>
<asp:TextBox ID="TextBoxAttid" runat="server" Text='<%# Eval("Att_id") %>'
BorderStyle="None"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Prior CMS Cutoff Date" >

<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Prior_Cutoff_Date") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Prior_Cutoff_Date") %>'></asp:Label>

</ItemTemplate>

</asp:TemplateField>
</Fields>
</asp:DetailsView>
<asp:Button
ID="btnNext"
Text="NEXT"
runat="server"
onClick="NextButton"
CssClass="RptFormButton" /> 

--------
protected void NextButton(object sender, EventArgs e)
{



TextBox tb = (TextBox)DetailsView1.FindControl("TextBox1.Text");
string name = DetailsView1.Rows[0].Cells[1];
}




Responses

#641902    Author: Paritosh Mohapatra      Member Level: Diamond      Member Rank: 6     Date: 14/Nov/2011   Rating: 2 out of 52 out of 5     Points: 2

Please check the following code:


TextBox tb = (TextBox)DetailsView1.Rows[0].FindControl("TextBox1");
string name = tb.Text;



Thanks & Regards
Paritosh Mohapatra
Microsoft MVP (ASP.Net/IIS)
DotNetSpider MVM



 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Save file in daabase using vb.net
Previous : Error in my project,any body correct this
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.