Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Substitute an Icon in a datagrid?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00768651
Message ID:
00768816
Vues:
27
Hi Stephen,

You don't reference the method. It is done automatically by ASP.NET since you are using Web Controls. You can leave ImageUrl property blank in the control itself since you will be dynamically assigning it in the ItemDataBound event.

>Thanks Cathi, now how do I reference this method of mine "MmDataGrid1_ItemDataBound" in the html?
>This is saying "No overload for method 'MmDataGrid1_ItemDataBound' takes '1' arguments" I feel my code is giving 1 argument.
>
>
>asp:Image ImageUrl='<%# MmDataGrid1_ItemDataBound(DataBinder.Eval(Container.DataItem, "ap_noprint")) ' Runat="server"
>
>
>Thanks
>__Stehen
>
>>Stephen,
>>
>>You want to use the ItemDataBound event of the DataGrid to set the ImageURL property of the DataColumn "To Print" that is being data bound for a particular row. Here is an example:
>>
>>
>>private void DataGrid1_ItemDataBound(object sender,
>>    System.Web.UI.WebControls.DataGridItemEventArgs e)
>>{
>>   System.Web.UI.WebControls.Image myControl =
>>      (System.Web.UI.WebControls.Image)e.Item.FindControl("MyImage");
>>   if(myControl!=null)
>>   {
>>      myControl.ImageURL = "MyURLFilePath";
>>   }
>>}
>>
>>
>>>How doI put an image in a row of data? Oh yeah let's make it tougher, it's a conditional statment {eg}
>>>
>>>In my SQL DB I have a SP to pull the data. I could add a case statement or can I do it in the datagrid?
>>>
>>>This is a "To Print" column, and they want a picture of a ????? printer showing them what is currently set for printing and what is still kept in-house.
>>>
>>>TIA
>>>
>>>__Stephen
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform