Click here to Skip to main content
15,900,906 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: how to hide the dropdown list items Pin
Michael Sync30-Dec-07 18:10
Michael Sync30-Dec-07 18:10 
AnswerRe: how to hide the dropdown list items Pin
DevSRKin27-May-12 23:30
DevSRKin27-May-12 23:30 
Questionhelp us very urgent Pin
Basheer30-Dec-07 16:56
Basheer30-Dec-07 16:56 
GeneralRe: help us very urgent Pin
Parwej Ahamad30-Dec-07 17:57
professionalParwej Ahamad30-Dec-07 17:57 
GeneralRe: help us very urgent Pin
Basheer30-Dec-07 19:00
Basheer30-Dec-07 19:00 
GeneralRe: help us very urgent Pin
Michael Sync30-Dec-07 18:17
Michael Sync30-Dec-07 18:17 
GeneralRe: help us very urgent Pin
Paul Conrad30-Dec-07 19:00
professionalPaul Conrad30-Dec-07 19:00 
QuestionHOW CAN I ACCESS THE BUTTON CONTROL FROM ASPX IN ASPX.CS? Pin
Albert8330-Dec-07 16:54
Albert8330-Dec-07 16:54 
Hi Everyone,

I get the error:The name 'postComment' does not exist in the current context
groups.aspx.cs doesn't see what's in the groups.aspx. I can't use the option of putting the code inside the aspx together. I would like to know how to access the textbox from the aspx.cs page

I have two pages:

groups.aspx
groups.aspx.cs

I have created a button in the groups.aspx as follows:

<asp:textbox id="postComment" runat="server">

Now I want to access it from the groups.aspx.cs to insert the contents of what was entered in the text box to the database as follows:

protected void postBtn_Click(object sender, EventArgs e)
{
SqlDataSource PostDS = new SqlDataSource();

PostDS.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();

PostDS.InsertCommandType = SqlDataSourceCommandType.Text;
PostDS.InsertCommand = "INSERT INTO GroupChalkboard (Text, GroupID, UserID, CreatedDate) VALUES (@Text, @GroupID, @UserID, @CreatedDate)";

PostDS.InsertParameters.Add("Text", postComment.Text);
PostDS.InsertParameters.Add("GroupID", pid.ToString());
PostDS.InsertParameters.Add("UserID", User.Identity.Name);
PostDS.InsertParameters.Add("CreatedDate", DateTime.Now.ToString());

PostDS.Insert();
}

Thank you.
AnswerRe: HOW CAN I ACCESS THE BUTTON CONTROL FROM ASPX IN ASPX.CS? Pin
Michael Sync30-Dec-07 18:08
Michael Sync30-Dec-07 18:08 
GeneralRe: HOW CAN I ACCESS THE BUTTON CONTROL FROM ASPX IN ASPX.CS? Pin
Albert8330-Dec-07 18:20
Albert8330-Dec-07 18:20 
GeneralRe: HOW CAN I ACCESS THE BUTTON CONTROL FROM ASPX IN ASPX.CS? Pin
Michael Sync30-Dec-07 18:40
Michael Sync30-Dec-07 18:40 
GeneralRe: HOW CAN I ACCESS THE BUTTON CONTROL FROM ASPX IN ASPX.CS? Pin
Albert8330-Dec-07 18:43
Albert8330-Dec-07 18:43 
GeneralRe: HOW CAN I ACCESS THE BUTTON CONTROL FROM ASPX IN ASPX.CS? Pin
Albert8330-Dec-07 18:45
Albert8330-Dec-07 18:45 
QuestionHow to use SSRS ? Pin
mehrdadc4830-Dec-07 6:00
mehrdadc4830-Dec-07 6:00 
AnswerRe: How to use SSRS ? Pin
Michael Sync30-Dec-07 6:40
Michael Sync30-Dec-07 6:40 
GeneralReading files from server and displaying links Pin
CodeBase2530-Dec-07 5:08
CodeBase2530-Dec-07 5:08 
GeneralRe: New Project, please advise!! Pin
Michael Sync30-Dec-07 6:35
Michael Sync30-Dec-07 6:35 
GeneralRe: New Project, please advise!! Pin
CodeBase2530-Dec-07 12:21
CodeBase2530-Dec-07 12:21 
QuestionObjectDatasource Edit/Delete problem Pin
arefkarimi29-Dec-07 23:47
arefkarimi29-Dec-07 23:47 
QuestionProblem updating database Pin
David Kalkwarf29-Dec-07 12:11
David Kalkwarf29-Dec-07 12:11 
GeneralRe: Problem updating database Pin
Michael Sync30-Dec-07 5:40
Michael Sync30-Dec-07 5:40 
GeneralUnable to work with IIS server Pin
Roney29-Dec-07 7:21
Roney29-Dec-07 7:21 
GeneralRe: Unable to work with IIS server Pin
Michael Sync29-Dec-07 7:51
Michael Sync29-Dec-07 7:51 
QuestionLocal CSS returns a 404? Pin
Mustafa Ismail Mustafa29-Dec-07 6:43
Mustafa Ismail Mustafa29-Dec-07 6:43 
AnswerRe: Local CSS returns a 404? Pin
Paul Conrad29-Dec-07 7:09
professionalPaul Conrad29-Dec-07 7:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.