Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 21st, 2006, 09:49 PM
Registered User
 
Join Date: Apr 2006
Location: Bangkok, , .
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

Reply With Quote
  #2 (permalink)  
Old April 23rd, 2006, 05:22 AM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 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?
Reply With Quote
  #3 (permalink)  
Old April 23rd, 2006, 12:08 PM
Registered User
 
Join Date: Apr 2006
Location: Bangkok, , .
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....

Reply With Quote
  #4 (permalink)  
Old April 23rd, 2006, 12:50 PM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 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?
Reply With Quote
  #5 (permalink)  
Old April 24th, 2006, 01:28 AM
Registered User
 
Join Date: Apr 2006
Location: Bangkok, , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to oatza
Default

Thank you so much.

Reply With Quote
  #6 (permalink)  
Old May 10th, 2006, 12:09 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 01:05 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.