CodeVerge.Net Beta


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

ASP.NET Web Hosting – 3 Months Free!



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: 1/3/2004 11:32:10 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 5 Views: 19 Favorited: 0 Favorite
6 Items, 1 Pages 1 |< << Go >> >|
christianprogra
Asp.Net User
Little (VERY) Help Please1/3/2004 11:32:10 PM

0/0

In my continued search on User, Custom, Composite ASP.NET server controls, I have now reached the point of attempting to include a datalist in my custom composite control.
I'm guessing this might be a handy little tool.
Regardless of the value of this concept and how I intend on implementing it, I have a question on the basics of filling a datalist. I have scoured counltless examples MS and others and everyone demonstrates creating a table and binding to it.

Ok I'm pretty good with ADO.NET so I can obtain a dataset or reader what have you.
I want to SIMPLY set my datalist to a dataset as its datasource and datamember to the appropriate tablename in this dataset.(Tablename as STRING RIGHT !! Not table as object! ? --RIGHT !! ?) Even Microsoft's example only demonstrated listbox binding no descent datalist example..... "Data Binding Multi-Record Web Server Controls" http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskdatabindingmulti-recordcontrols.asp
I understand that I need to set the DataKeyField property to the name of a column that one can use at run time to identify individual items. If it is available, you usually use the primary key....excerpt...
I run my stuff and no datalist I even get the "databound" prompt in design mode in the designer but no control during run.
I appreciate any and all insight, and I truly thank anyone kind enough to post a brief snippet to educate me. Please note my code is all from a code behind,, I would appreciate responses in the same format.. some of us are really glad we don't have to learn alot of HTML to develop robust Web applications. Do I have to do anything in the DataList_ItemCreated..? A couple of examples hinted at that but I'm not getting it....

I'm sure you all know how it goes I just need to get some data in it. I can pretty much rip it up and move on to paging a datalist thereafter.

Thanks all
Milwaukee MCSD (ver6)

using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace DtaLstTst
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
protected System.Data.OleDb.OleDbConnection oleDbConnection1;
protected DtaLstTst.dsTest dsTest1;
protected System.Web.UI.WebControls.Label lblMain;
protected System.Web.UI.WebControls.DataList DTaLst5;
protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
protected System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
protected System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;
protected System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;
protected System.Web.UI.WebControls.ListBox ListBox1;
protected System.Web.UI.WebControls.DataList DtaLst;


private void Page_Load(object sender, System.EventArgs e)
{

if (! this.IsPostBack)

{
DTaLst5.DataSource = dsTest1;
DTaLst5.DataMember = dsTest1.Tables[0].TableName.ToString();
// for testing we could throw in ---"Employees"--- without the stress
DTaLst5.DataKeyField = "EmployeeID";
DTaLst5.DataBind();


}
}
master4eva
Asp.Net User
Re: Little (VERY) Help Please1/4/2004 9:10:19 AM

0/0

Hi,

I do not know what complexity you want it but here is some code for starters:

public class MyDataList : DataList {
protected override void OnLoad(EventArgs e) {
if (!Page.IsPostBack) {
// do your databinding here
DataSource = myReader;
DataBind();
}

base.OnLoad(e);
}
}

It is called inheriting or resusing a server control... am I right this is what you want to achieve?
-- Justin Lovell
christianprogra
Asp.Net User
Re: Little (VERY) Help Please1/5/2004 6:18:39 PM

0/0

Follow up question
// do your databinding here

Yea thats not intuitive,,,, am I binding controls in the datalist to fields or
are you just talking about my regular data access stuff ,,, getting the Dataset or reader in this case

THats my problem do I have to set up bindings
for the lets say textboxes in the datalist individually???
Or is the above all thats required to
fill textboxes (in the data list) with data from the
datasource. I'm wondering if I have to
bind each textbox ...placed in the datalist..
as well?

You are required to place bindable controls in the datalist
No??
I'm just doing data list basics..
trying to understand its functionality.


small example if possible just one sub control being bound

thanks for the reply...

did just that (your example) last night with datagrid to
prove I could do it with data list..
you know they should of made the web form and win form datagrid binding processes the same.

Trying your sample on a datalist now..
01/05/04 Noon Central time.
christianprogra
Asp.Net User
Re: Little (VERY) Help Please1/5/2004 7:54:24 PM

0/0

Yea theres gotta be more to it than just that.

The supplied suggestion is great for just a datagrid...
but the datalist obviously requires more ..
as it contains ..lets say textboxes ...for my example in
its various "templates"

I want to specify what field is going into the ItemTemplate...
from there my goal is to understand the remaining templates...
selected, edit etc... and appropriate events therein...

When I (through the property wizard) set the databindings for
the textbox in the itemTemplate section of the datalist.

I only have a few choices available under Simple binding..
in the Container option I selected DataItem...Producing the
binding expression...DataBinder.Eval(Container, "DataItem")..
this isnt giving me the field

I do get a row with 9 fields representing the Employees' fields from Northwind...
but they all contain: "System.Data.DataRowView" no values...

if I change my selection in the data binding bot the textbox (ItemTemplate) to ItemIndex
I get numeral values 0 - 8 in the datalists' 9 fields.

How do I corectly bind the field(s) to the datalist.

Please forgive the novice nature of this question but
trying to locate a good example is becomming quite frustrating.


christianprogra
Asp.Net User
Lil Help DataList ANSWER..1/5/2004 8:10:04 PM

0/0

You had some descent links on the knowledgebase search...
but I found this...


ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbcon/html/vbconmulti-recordsingle-valuedatabinding.htm


Multi-Record and Single-Value Data Binding for Web Forms Pages
Binding Single-value Controls in Templates
Multi-record controls such as the DataList, Repeater, and the DataGrid controls include templates used to render individual records from the data source. The templates in turn often contain single-value controls such as TextBox and Label controls that are bound to data.

Note For details about templates, see Web Server Controls Templates.
Because the single-value controls in the template can bind to only one value, you need to specify which record to bind to. The parent control makes this possible by exposing two objects that you can use in a data-binding expression:

The Container object refers to the parent control, which in turn is bound to a data source.
The DataItem object references the record currently being processed by the parent control.
A data-binding expression for a TextBox control in a DataList control template might look like the following:

DataBinder.Eval(Container, "DataItem.au_lname")

I'm good now !

Datalist is a dancing away perfectly

Peace

master4eva
Asp.Net User
Re: Lil Help DataList ANSWER..1/9/2004 7:55:26 AM

0/0

Glad that you found the answer. I answered your other, more advanced question on the other thread.
-- Justin Lovell
6 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Little Women ; Little Men ; Jo's Boys: Little Men ; Jo's Boys Authors: Louisa May Alcott, Elaine Showalter, Pages: 1092, Published: 2005
Little Women Authors: Louisa May Alcott, Pages: 480, Published: 2004
Alice's Adventures in Wonderland and Through the Looking Glass Authors: Lewis Carroll, Pages: 108, Published: 2005
The Personal History of David Copperfield Authors: Charles Dickens, Pages: 364, Published: 2005
The Beatles Anthology Authors: Beatles, Beatles, Brian Roylance, Paul McCartney, John Lennon, George Harrison, Ringo Starr, Pages: 368, Published: 2000
8 Books in 1: Jane Austen's Complete Novels. Sense and Sensibility, Pride and Prejudice, Mansfield Park, Emma, Northanger Abbey, Persuasion, Lady Susan, and Love and Friendship Authors: Jane Austen, Pages: 808, Published: 2006

Web:
UrbanBaby - A little help please. I use to be very a... - Talk A little help please. I use to be very assertive and confident sexually with dh. since dd's I have lost all of this. If ...
PTSD: a little help, please | Ask Metafilter PTSD: a little help, please March 3, 2007 3:57 PM RSS feed for this thread ... I know they do very good work. My mom did treatment for PTSD and also a lot ...
A little help please? - VideoHelp.com The more I learn, the more I come to realize how little it is I know. ... Don't forget the whole risk of outsourcing issue (software=very ...
Girls, very embarrassing. Please help, little cut on vagina lips ... I have a very tiny cut, where the regular skin, an…
A little help please!!!!! - Albanian Forums You are very welcome. If you need any more help, reply on this same thread due to ... Yes as predicted I need a little more help!! please! ...
Little help please.. | Photo Answers Re: Little help please.. I have very occasionally noticed similar spots on the odd photo of mine, but on (very) close inspection, I realised the 'spots' ...
Please help me ! My Darkdramon do a very little damage ! | Digimon ... Oct 2, 2008 ... Help me please... I have a lvl 56 darkdramon with 999 attack but it only do a very little damage to anubismon lvl 80 while my IPdramonFM lvl ...
A little help please (Allentown, Whitehall: trip , housing ... A little help please (Allentown, Whitehall: trip , housing, buildings) .... Please register to post and access all features of our very ...
LITTLE SARAH NEEDS YOUR HELP PLEASE!!! « Daily Kitten Chat Forum LITTLE SARAH NEEDS YOUR HELP PLEASE!!! (31 posts) ... That was very thoughtful of you. Sarah just came in the house from outside and she seemed to be ...
Few issues. Very simple. A little help please? - InsanelyMac Forum Few issues. Very simple. A little help please? Options V ... I'm running on BrazilMac. The very first release after the official release from Apple. ...

Videos:
A VERY SAD VIDEO DENISE PIPITONE MISSING LITTLE GIRL PLEASE MERCI DE REGARDER CETTE VIDEO ET DE LA METTRE SUR VOS BLOG PEACE FOR THIS LITTLE ANGEL Help us find little Denis and Madeleine! They Need to be with...
Kashmir Earthquake, Winter Aftermath. Kashmiri people need your help. Please Visit http://www.turntoislam.com for more documentaries. For this video Please Link to our webSite. ... >all » http://www.turntoislam.com ...
HELP... FINDING MADELEINE MCCANN - 3 YEARS OLD LITTLE GIRL PHOTOS ARE HERE: http://helpmadeleinemccann.blogspot.com , OFFICIAL WEBSITE: http://www.findmadeleine.com/ PLEASE IF YOU KNOW SOMETHING ABOUT MADELEI...
Little Big Adventure 2 Interview An interview with the creators of the computer game "Little Big Adventure 2".(also knowing as LBA2 or Twinsen's Odyssey) LBA2 was the sequel to the ...
My Funny Hungry Old Little Dog Idol Hello!I am a german shepherd dog!I have a kind master who loves me very much,who is screwing around and playing with me much,but he is very poor and ...
SIGN THIS PETITION! VERY IMPORTANT** PLEASE, SIGN THE PETITION AND SPREAD THE WORD! THANK YOU: http://gopetition.com/online/19533.html Our names are Maggie and Emily and together we've...
PLEASE HELP US . . . We're here in philippines. My sister recently had a baby girl, last February 14. Basically the doctors saw signs of Autism. True enough, through furt...
Project Camelot interviews Dan Burisch - Part 4 (June 2007) Stargate Secrets: Dan Burisch revisited (Part 1) A video interview with Dan Burisch Las Vegas, June 2007 Those familiar with Project Camelot's wor...
PLEASE HELP JAVIER! We went to Peru in March of 2007.There,we befriended a young teenager from LIMA,PERU.His name is JAVIER ANDRES OTINIANO ZAMUDIO.He is 15 YEARS OLD an...
Madeleine Mccann : OFFICIAL SONG DONATED TO HELP FIND MADELEINE This song has been donated to help find Madeleine mccann ... * Madeleine McCann disappeared on May 3, 2007 from Praia de Luz, Portugal. Anyone wit...




Search This Site:










automatically add register tag on page

free asp.net hosting???

postback and usercontrol.

class exposed as property with multiple instances.

terminal services hosting solution

web hosts reseller programmes

when oncomponentchanged event get fired in a custom designer

composite control causing datagrid to not render

building a custom control

properties and methods not recognised

server control load mechanism

exposing listcontrol properties from within composite control

installing iewc-control (treeview...etc.) -problem ?

asp hosting recommendation

setting properties of a custom web control

inamingcontainer interface problems

treeview and datagrid need to comminicate. how?

find position of control in design time.

design time support - add html for multiple web controls

server control properties.... by value? or by reference?

godaddy - encrypt connection string

dynamically added user control disapearing on postback

problems with clientid on composite control

gac assembly conflicts with bin assembly

setting the position of a control

trying to find web hosting at reasonable cost for number of databases used with my sites.

help to customize linkbutton

customizing the asp.net 2.0 wizard control

need hosting with full trust level

nested tags in custom control

  Privacy | Contact Us
All Times Are GMT