Hello experts
I need urgent help
I have a radGrid in which i want to have an image column that will display different images depending on the selected DataField value.
Like i have a field called status in on of my table which contains the values 0,1,2
If the user enters 0 value then the image should show according to that selected value, same as with 1 and 2 values.
Images have given for the values are in this way, which are stored in my project directory
0 for "out-image.jpg"
1 for "in-image.jpg"
2 for "locked-image.jpg"
From the example below please can you advise 2 things
1) Is the systax below correct to make any column of the grid to appear as imagecolumn?
2) how can I change the values of this column from the code behind based upon below conditions
<telerik:GridImageColumn DataType="System.String" DataImageUrlFields="CustomerID" DataImageUrlFormatString="IMG/{0}.jpg"
AlternateText="Customer image" DataAlternateTextField="ContactName" ImageAlign="Middle"
ImageHeight="110px" ImageWidth="90px"
HeaderText="Image Column" FooterText="ImageColumn footer" />
If datafield value= 0 then
image.souce = "out-image.jpg"
elseif datafield value= 1 then
image.souce = "in-image.jpg"
elseifd datafield value= 2 then
image.souce = "locked-image.jpg"
end if
I hope you understand what I am trying to say.
Thanks for your help.
======================================
I need urgent help
I have a radGrid in which i want to have an image column that will display different images depending on the selected DataField value.
Like i have a field called status in on of my table which contains the values 0,1,2
If the user enters 0 value then the image should show according to that selected value, same as with 1 and 2 values.
Images have given for the values are in this way, which are stored in my project directory
0 for "out-image.jpg"
1 for "in-image.jpg"
2 for "locked-image.jpg"
From the example below please can you advise 2 things
1) Is the systax below correct to make any column of the grid to appear as imagecolumn?
2) how can I change the values of this column from the code behind based upon below conditions
<telerik:GridImageColumn DataType="System.String" DataImageUrlFields="Custom
AlternateText="Customer image" DataAlternateTextField="Co
ImageHeight="110px" ImageWidth="90px"
HeaderText="Image Column" FooterText="ImageColumn footer" />
If datafield value= 0 then
image.souce = "out-image.jpg"
elseif datafield value= 1 then
image.souce = "in-image.jpg"
elseifd datafield value= 2 then
image.souce = "locked-image.jpg"
end if
I hope you understand what I am trying to say.
Thanks for your help.
======================================
<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" AllowPaging="True" ShowFooter="True"
runat="server" AutoGenerateColumns="False" AllowSorting="True" PageSize="3"
GridLines="None" CellPadding="0" AllowMultiRowSelection="true">
<MasterTableView ShowFooter="True">
<Columns>
<telerik:GridClientSelectColumn UniqueName="CheckboxSelectColumn" FooterText="CheckBoxSelect footer" />
<telerik:GridImageColumn DataType="System.String" DataImageUrlFields="CustomerID" DataImageUrlFormatString="IMG/{0}.jpg"
AlternateText="Customer image" DataAlternateTextField="ContactName" ImageAlign="Middle"
ImageHeight="110px" ImageWidth="90px"
HeaderText="Image Column" FooterText="ImageColumn footer" />
<telerik:GridBoundColumn FooterText="BoundColumn footer" UniqueName="ContactTitle"
SortExpression="ContactTitle" HeaderText="Bound<br/>Column" DataField="ContactTitle">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn FooterText="LinkButtonColumn footer" DataTextFormatString="Remove selection"
UniqueName="column1" HeaderText="LinkButton<br/>Column" CommandName="Deselect"
DataTextField="CustomerID">
</telerik:GridButtonColumn>
<telerik:GridButtonColumn FooterText="ImageButtonColumn<br/>footer" DataTextFormatString="Select {0}"
ButtonType="ImageButton" UniqueName="column" HeaderText="ImageButton<br/>Column" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
CommandName="Select" DataTextField="CustomerID" ImageUrl="~/Common/Img/Icons/Grid.gif">
</telerik:GridButtonColumn>
<telerik:GridHyperLinkColumn FooterText="HyperLinkColumn footer" DataTextFormatString="Search Google for '{0}'"
DataNavigateUrlFields="CompanyName" UniqueName="CompanyName" DataNavigateUrlFormatString="http://www.google.com/search?hl=en&q={0}&btnG=Google+Search"
HeaderText="HyperLink<br/>Column" DataTextField="CompanyName">
</telerik:GridHyperLinkColumn>
<telerik:GridCheckBoxColumn UniqueName="GridCheckBoxColumn" DataField="Bool" HeaderText="CheckBox Column" FooterText="CheckBox column footer" />
<telerik:GridTemplateColumn UniqueName="TemplateColumn" SortExpression="CompanyName"
InitializeTemplatesFirst="false">
<FooterTemplate>
Template column footer</FooterTemplate>
<FooterStyle VerticalAlign="Middle" HorizontalAlign="Center" />
<HeaderTemplate>
<table id="Table1" cellspacing="0" style="width:240px;" class="myTable">
<tr>
<td colspan="2" align="center">
<b>Contact details</b></td>
</tr>
<tr>
<td style="width: 50%">
<asp:LinkButton CssClass="Button" ID="btnContName" Text="Contact name" ToolTip="Sort by ContactName"
CommandName='Sort' CommandArgument='ContactName' runat="server" /></td>
<td style="width: 50%">
<asp:LinkButton CssClass="Button" ID="btnContTitle" Text="Contact title" ToolTip="Sort by ContactTitle"
CommandName='Sort' CommandArgument='ContactTitle' runat="server" /></td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table cellspacing="0" width="100%" class="myTable">
<tr>
<td style="width: 50%">
<%# Eval("ContactName") %>
</td>
<td style="width: 50%">
<%# Eval("ContactTitle") %>
</td>
</tr>
</table>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="true" />
</ClientSettings>
</telerik:RadGrid>