Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
| 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 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
  #11 (permalink)  
Old October 9th, 2006, 05:27 PM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In the code below value in the textbox is not being set.
Can you give a solution.

Dim t As TextBox
        Dim selectedValue As String = DropDownList2.SelectedValue
        t = Me.FormView1.Row.FindControl("TextBox1")
        t.Text = selectedValue


  #12 (permalink)  
Old October 10th, 2006, 05:55 AM
Friend of Wrox
 
Join Date: Oct 2005
Location: , , United Kingdom.
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

HI Amit2604

I think the problem is that u need to use FindControl for DropdownList2 before assigning it to selectedValue.. thats if it is within Formview1 too:

Dim t As TextBox
        Dim selectedValue As DropDownList = FormView1.FindControl("DropDownList2")
        t = Me.FormView1.Row.FindControl("TextBox1")
        t.Text = selectedValue.SelectedValue

Rit
  #13 (permalink)  
Old October 10th, 2006, 06:03 AM
Friend of Wrox
 
Join Date: Oct 2005
Location: , , United Kingdom.
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

... also notice the declaration of selectedValue being DropdownList instead of String.

Dim selectedValue As DropDownList = FormView1.FindControl("DropDownList2")

..And the way it is being used in the last line

 t.Text = selectedValue.SelectedValue
  #14 (permalink)  
Old October 10th, 2006, 02:25 PM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Rit
Thanks for responding.
But my dropdownlist list is not inside FormView.
I can simply get the value from dropdownlist2.SelectedValue.
This value I am trying to assign to one of the textbox in FormView.


Amit

  #15 (permalink)  
Old October 11th, 2006, 12:07 PM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Rit
I placed the dropdown list inside the formview and it is working now.

Thanks for guiding
Amit

  #16 (permalink)  
Old October 11th, 2006, 02:33 PM
Friend of Wrox
 
Join Date: Oct 2005
Location: , , United Kingdom.
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

Thats no problem. Sorry I didn't get back to you earlier.. A little manic here!

Rit




Similar Threads
Thread Thread Starter Forum Replies Last Post
max length property of multiline text box MunishBhatia ASP.NET 2.0 Professional 5 June 14th, 2007 01:55 AM
Text Box .text Property Displays conflicting Valus JPOhlman Visual Basic 2005 Basics 3 August 23rd, 2006 02:39 PM
text-property in a non-server control propellis .NET Web Services 0 July 4th, 2006 03:29 AM
Can't set text property of dynamic text box sreerajrs ASP.NET 1.0 and 1.1 Professional 1 May 31st, 2006 09:39 PM
User Control Name in a Text Property laslanid Pro VB.NET 2002/2003 0 February 24th, 2005 04:31 AM





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