CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 8/26/2004 7:59:05 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 56 Favorited: 0 Favorite
5 Items, 1 Pages 1 |< << Go >> >|
MarkusJ_NZ
Asp.Net User
Retrieve individual textbox values (Custom server control)8/26/2004 7:59:05 PM

0/0

Hi, I am playing around with creating custom server controls for use within
a ASP.NET page. I am creating a contact form and have the following question

I am capturing the form postback data in a routine called LoadPostData that
has the following signature and which implements the IPostBackDataHandler
event handler

public bool LoadPostData(string postDataKey,
System.Collections.Specialized.NameValueCollection postCollection)
{

}

If I examine the postCollection collection and pass in the uniqueID
(postDataKey) of my control, I do in fact retrieve the information entered
in the contact form, delimited by a "," character.

e.g my custom control has input fields

txtName
txtPhone
txtEmail

As a test I entered the following data in the control and pressed the submit
button

Mark
06123456
[email protected] <mailto:[email protected]>

In the routine LoadPostData if I do the following

string sData = postCollection[postDataKey];

sData becomes "Mark,06123456,[email protected]"

so the information is captured correctly.

What I would like to be able to do is query each of the text objects
(txtName, txtPhone, txtEmail) and retrieve their individual values (Like
Request.Form("txtName") in classic ASP).

Failing that, I was thinking that I could just do a split on the returned
data ("Mark,06123456,[email protected]" in the above example) using the ","
character and then examine the array. The problem with this is if someone
enters a "," character in any of the textfields then the split would not be
accurate.

Is there a way that I can suggest the delimiter ("|" for example) used
instead of a "," character?

e.g
Data is returned as "Mark|06123456|[email protected] <mailto:Mark|06123456|[email protected]>"

Thanks in advance
Cheers
Mark

=================================
Inspirational quotes database
www.notableandquotable.com
master4eva
Asp.Net User
Re: Retrieve individual textbox values (Custom server control)8/27/2004 6:33:13 PM

0/0

Look for the request values in the NameValueCollection. It is there :-) . Don't look through the postData string.
-- Justin Lovell
MarkusJ_NZ
Asp.Net User
Re: Retrieve individual textbox values (Custom server control)8/28/2004 10:00:17 AM

0/0

Hi Justin, thanks for your help, could you give me an example of how to do this??

I tried iterating through the collection but came up with pretty much the same string
VB code below


Dim RequestValue As String
For Each RequestValue In NameValueCollection.AllKeys
Dim oS As String = postCollection(s)
Next


Thanks again
Mark
=================================
Inspirational quotes database
www.notableandquotable.com
master4eva
Asp.Net User
Re: Retrieve individual textbox values (Custom server control)8/28/2004 4:37:55 PM

0/0

Hi Mark,

All you have to do is think in dictionary terms. You want txtName, txtEmail, ect. so look up that as the index in the collection. Just a mock example:

string userName = postCollection["txtUserName"];
string email = postCollection["txtEmail"];
// ...

(And I don't know why you assumed that I just code in VB.NET... my articles are written with C# code :-) )
-- Justin Lovell
MarkusJ_NZ
Asp.Net User
Re: Retrieve individual textbox values (Custom server control)8/28/2004 7:53:21 PM

0/0

Hi Justin, again, thanks for your help :) Re C# and VB no, certainly no assumption there, I just hacked out some pseudo code for the iteration off the top of my head and forgot that my previous example was in C# lol, must be a Saturday ;)

Again, thanks for your help
Regards
Mark
=================================
Inspirational quotes database
www.notableandquotable.com
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET AJAX Programmer's Reference: With ASP.NET 2.0 Or ASP.NET 3.5 Authors: Shahram Khosravi, Pages: 1522, Published: 2007
Professional ASP.NET 2.0 Server Control and Component Development Authors: Shahram Khosravi, Pages: 1186, Published: 2006
Pro ASP.NET 2.0 in VB 2005: special edition. Authors: Laurence Moroney, Matthew MacDonald, Pages: 1360, Published: 2006
Essential ASP.NET with Examples in Visual Basic .NET: With Examples in Visual Basic.Net Authors: Fritz Onion, Pages: 395, Published: 2003
Professional IIS 7 and ASP.NET Integrated Programming Authors: Shahram Khosravi, Pages: 670, Published: 2007
Professional Web Parts and Custom Controls with ASP.NET 2.0 Authors: Peter Vogel, Pages: 449, Published: 2005
Foundations of ASP.NET AJAX Authors: Robin Pars, Laurence Moroney, John Grieb, Pages: 268, Published: 2007
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Sams Teach Yourself ASP.NET in 21 Days Authors: Chris Payne, Pages: 1104, Published: 2002
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007

Web:
ASP.NET Custom Server Control - Extend TextBox Control ViewState ... Thus, we end up having to run expensive queries to retrieve meta data ... NET TextBox server control by adding a custom made namevaluecollection class and ...
Retrieve TextBox.Text Value in Web User Control - ASP.NET Forums On click of the button in the custom web control, read the value .... Net TextBox Server Control instead of Standard HTML TextBox control. ...
Passing Server Control Values Between Pages To send Server control values from a different Web Forms page. Create a code- behind file for the ... TextBox Protected Button1 As System.Web.UI.WebControls. ...
Page 2 - ASP.NET Custom Server Controls: Cute ASP.NET TextBox Control Page 2 - ASP.NET Custom Server Controls: Cute ASP.NET TextBox Control. ... Retrieving Data with AJAX and the GridView C... - Playing with Images in ASP. ...
CodeProject: SqlWhereBuilder ASP.NET Server Control. Free source ... Individual values (entered through form inputs in the ValueEntry area) are then ... For its part, the SqlWhereBuilder server control is marked with the ...
Building a Custom Validator Control - Part 1 So to follow with this category I'll be writing server control articles now and ... length of the contents of the TextBox must be between these two values. ...
custom Email control in asp .net using C# Apr 16, 2005 ... We all have used Web Server Controls like datagrid, textboxes, buttons and calendars. But have you ever thought of making your own custom ...
Data Manipulation using ListView Server Control with ASP.NET 3.5 ... We should write a custom function which will retrieve the textbox content and inserts ... All we have to do is get the value of the label server control. ...
Custom web control. Get Textbox.text value - ASP.NET Forums I need to be able to retrieve the values in the corresponding TextBox when a ... Try exposing the TextBox of your custom control as a public ...
Data Binding Button, TextBox and DropDownList cont - In Depth ASP ... The TextBox server control is an input control which allows the user to ... Password creates a single-line text box that masks the value entered by the user ...




Search This Site:










content pages & head tags

trying to use vs 2008 training kit

auto insert, how ?

help please

version controlj and collaboration recommendations

how to format the java script

feature comparison

installing visual studio 2005 after a 2008 install

xslt intellisense in vs 2008 standard

visual studio 2008 hangs while loading setup projects

avoid have x no. of developer server start up at debug

asp.net website admin tool + vs 2008 + vista x64

exception assistant mia?

what is the recommended way to deploy websites in vs2008?

ajax scriptmanager does not work in vs 2008

intellisense problems

pors and cons using vs 2008 with an anemic domain model

vs 8 - vista problem - duplicate control error in designer

auto add re-compiled ddl file from another class project to bin folder of a web site project

creating a typed datatable for a custom stored procedure.

vs2008 designer adding dbml with incorrect language for linq

datapager and linqdatasource - where does it get the number of total pages.

bin folder and dll issues in vs 2008

when vs orcas or 2008 released ?

deploying sub projects with vs 2008

confused - does visual web developer 2008 include the ajax toolkit?

visual studio 2008's webserver doesnt shut down ?

ajax problem

vs2008 team products & licenses

object reference not set to an instance of an object

  Privacy | Contact Us
All Times Are GMT