dAdapt.Fill(dSet, ';tb_employees';);
GridView1.DataSource = dSet;
GridView1.DataMember = ';tb_employees';;
GridView1.DataBind();.NET DataGrid Variables?
Not enough code. How are you filling the dataset? One easy way of doing it is using a template column in the data grid and then use a function to get the value you want.
%26lt;asp:GridView ID=';gvCountryTaxes'; runat=';server'; AllowSorting=';True'; AutoGenerateColumns=';False'; DataSourceID=';sdsCountryTaxes'; DataKeyNames=';CountryCode';%26gt;
%26lt;Columns%26gt;
%26lt;asp:BoundField DataField=';EmployeeID'; HeaderText=';ID'; SortExpression=';EmployeeID'; ReadOnly=';True'; /%26gt;
%26lt;asp:TemplateField HeaderText=';Regions';%26gt;
%26lt;ItemTemplate%26gt;
%26lt;%# GetMyValue(Container.DataItem(';EmployeeN鈥?br>
%26lt;/ItemTemplate%26gt;
%26lt;/asp:TemplateField%26gt;
%26lt;/Columns%26gt;
%26lt;/asp:GridView%26gt;
Then in the code behind
Function GetMyValue(ByVal sName As String) As String
If sName=String.Empty Then
Return ';N/a';
Else
Return sName
End If
End Function
you may also want to search the forums on http://www.asp.net.NET DataGrid Variables?
You can use following code segment
String name;
name=dSet.rows[0].coloum[';Name';];
now you can use it to check for specific value like
if(name==';John';)
{
}
No comments:
Post a Comment