CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 How to add code in Before Show Row in C# ?

Print topic Send  topic

Author Message
Jean
Posted: 07/08/2002, 5:58 PM

Hi,

I looking for codes in C# how to reference to a field in a grid in the
Before Show Row event. I generated the grid (list page) using the wizard.
By looking at the code, I know there is a data repeater object.

Thanks

Jean

Sanddy
Posted: 07/08/2002, 10:47 PM

Well the "Before Show Row" event for the DataGrid maps to the
OnItemDataBound event of the Repeater, which can be clearly seen if you
switch to code view...
Well inside this method .. you will have to first search for the Control ..
using the
e.Item.FindControl("controlName") etc .. see the MSDN .NET Reference
Documentation .. it has code on usage of the OnItemDataBound event of the
Repeater.

eg
//Check the ListItem type .. since headers and footers
//won't have these controls
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
//Get the control
System.Web.UI.WebControls.Literal
ImagesImageID=(System.Web.UI.WebControls.Literal)(e.Item.FindControl("Images
ImageID"));

}

But if you want to modify a field from the Grid, it will be more easy, if
you select the field in the Grid add the event to the "Before Show" of the
field ...
This will again map to the OnItemDataBound event, but in this case CCS will
also write all the necessary code to find the control from the Repeater....


CCS Fan,
Sanddy


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.