I am working on a new C# asp.net 2010 webforms application. I am trying to obtain the value loaded into a textbox(cell) for a detailsview control. When I step through the code, the debugger says the value is NULL. However when I run new the web page, there is the correct value loaded into the cell(textbox).
When I am trying to access the cell, I am clicking on a button that is not inside of the detailsview control. This is the requestor's preference. If I need to use only the buttons in the detailsview control, please let me know and how would you code it?
The following is the code I have right now:
<%@ Page Language="C#" MasterPageFile="~/RpApp.Master" AutoEventWireup="true"
CodeBehind="Detail.aspx.cs" Inherits="Support.Att_Detail" %>
TableName="Attestations" Where="Att_id == @Attid">
Text="NEXT"
runat="server"
onClick="NextButton"
CssClass="RptFormButton" />
--------
The following is the code in the aspx.cs file
protected void NextButton(object sender, EventArgs e)
{
TextBox tb = (TextBox)DetailsView1.FindControl("TextBox1.Text");
string name = DetailsView1.Rows[0].Cells[1];
}
Amit MaheshwariPosted Nov 15, 2011, 6:19 PM
Dc
Please see the Url-:http://forums.asp.net/t/1055882.aspx/1
I hope help to you.