Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 21st, 2006, 09:49 PM
Registered User
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to oatza
Default How I insert button into table for select row.

I want to insert a select button into the table in pop up page but when I run, my button not show in the table. How do I?, pls. tell me. thanks.
this is my sample code

in the code behind
in table :
Response.Write("<TD ALIGN=CENTER>")
Response.Write("<asp:Button Text='Select' CommandName='Select' CommandArgument='" & Rs("Pcode") & "' runat='server'/>")
Response.Write("</TD>")
Response.Write("<TD ALIGN=LEFT>" & Rs("Pcode") & "</TD>")
Response.Write("<TD ALIGN=LEFT>" & Rs("Pname") & "</TD>")

And when the button click then I want to call Sub ItemCommand. How do I? Help me.

Protected Sub ItemCommand(ByVal sender As Object, ByVal e As RepeaterCommandEventArgs)
        Session("Pname") = e.CommandArgument
        lbMsg.Text = "Hello"
End Sub

 
Old April 23rd, 2006, 05:22 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

This will never work. The code you posted looks too much like classic ASP where you use Response.Write to send out *HTML* to the browser.

However, ASP.NET Controls like the text box are server side controls that are capable of sending HTML to the browser. If, instead, you send the ASPX markup of such a control to the client, all you get there is the flat text, like <asp:Button> instead of a true control.

You need to rethink your strategy a little. You don't need Response.Write anymore, but instead you need to New up a control and add it to the page or another control:
Code:
Dim myTextBox As new TextBox()
myTextBox.ID = "SomeControlId"
myTextBox.Text = "Hello World"

myPlaceHolder.Cotrols.Add(myTextBox)
This code assumes you have an <asp:PlaceHolder> control called myPlaceHolder on the page somewhere.
HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Catherine by P.J. Harvey (Track 6 from the album: Is This Desire?) What's This?
 
Old April 23rd, 2006, 12:08 PM
Registered User
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to oatza
Default

Imar, Thank you very much for your answer. But I don't understand it all. I just start to learnning asp.net, you can show me more example. Now I have the parent page call the child page. It's a modal dialog and I want to select data from Table or Data Grid in the child page. Then when I selected, I want to pass value back to parent page. I want to do? Help me....

 
Old April 23rd, 2006, 12:50 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Passing data from a child form to a parent page is not something that can be done with ASP.NET. You'll need something like JavaScript for that.

If you Google for the terms "modal dialog pass data child parent page" you'll find plenty of useful information.

If you still can't make it work, I think you're better off reposting this question at one of the JavaScript forums here at p2p.wrox.com...

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: The Sleepless by Red Snapper (Track 1 from the album: Making Bones) What's This?
 
Old April 24th, 2006, 01:28 AM
Registered User
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to oatza
Default

Thank you so much.

 
Old May 10th, 2006, 12:09 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

JavaScript is the best way, you could also set session variables on the pop up page and retrieve them from the parent page.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Select row in GridView WITHOUT using Select button rao965 ASP.NET 2.0 Professional 1 February 15th, 2008 10:44 AM
insert row into table stealthdevil Access VBA 11 June 16th, 2007 08:32 AM
insert from one table to 2nd if row already exists brocktune SQL Server 2000 2 May 15th, 2007 12:56 AM
Insert New Row into Table (VB 2005) adit9 Visual Basic 2005 Basics 0 March 3rd, 2006 03:25 AM
Insert Row Into Access Table With VBScript ritag Classic ASP Databases 2 August 5th, 2004 08:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.