automatt
|
| Posted: 03/05/2002, 1:08 AM |
|
How do I get or set custom fields that I've added to a form (such as for displaying an <img> tag from a url).
fldPhotoURL = "<img src='Photo.aspx?UserID="+PlayerList_UserID+"&XSize=50'>";
isn't working.
PlayerList_PhotoURL = "<img src='Photo.aspx?UserID="+PlayerList_UserID+"&XSize=50'>";
Does not work either.
|
|
|
 |
Alex Alexapolsky
|
| Posted: 03/05/2002, 1:58 AM |
|
Take a look at the generated code and see what field name is used to
this url field , it may be different from standard field naming convention,
as it is ULR field
|
|
|
 |
automatt
|
| Posted: 03/06/2002, 1:21 AM |
|
It is not a DB variable but rather a custom column added in the cc environment that I am trying to access. I can't find it anywhere in the source but there is a <asp:Label> tag in the html template.
|
|
|
 |
SN
|
| Posted: 03/06/2002, 9:05 AM |
|
The ASP.NET Code Generated by Code Charge generally uses the notation of <FormName>_<FieldName>. Considering your Form Type is 'Record' (this won't work in Grid Form Type), you can use the following
PlayerList_PhotoURL.Text = "<img src='Photo.aspx?UserID="+PlayerList_UserID.Text+"&XSize=50'>";
(Considering PlayerList_UserID is a Label, if its a Hidden Control use PlayerList_UserID.Value )
Remeber the you are using a Label field (ASP.NET Label Server-Side Web Control) here, so you need to assign value to the 'Text' property.
In case you are using a Grid Form Type, then things get a slight more complex, since CodeCharge uses the Repeater ASP.NET server-side Web Control, and you cannot access sub-fields, you need to add the following code into the 'Before_Show' event of the Form, which internally maps to the Repeater_ItemDataBound Event of the Repeater Control.
Use Code like
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
//Use Reflection to find the sub-control
((Label)e.Item.FindControl("PlayerList_PhotoURL ")).Text =
""<img src='Photo.aspx?UserID="+ Session["UserID"].ToString()+"&XSize=50'>";
}
Considering that you retrive the UserID form the Session object ...
If you are retriving a value from the database, you the notation
((DataRowView)e.Item.DataItem )["a_ad_category_id"].ToString()
Where 'ad_category_id' is the table filed name and 'a' is the first character of your Table.
|
|
|
 |
automatt
|
| Posted: 03/07/2002, 12:17 AM |
|
Thanks for your help. I wound up using a view and putting the URL-generation logic there. Hopefully it will work for a while until using the view causes problems.
Thanks!
Matt
|
|
|
 |
|