Tips


  • If you Select the Datagrid and need the data of the selected Datakey

1) Convert.ToInt32(Datagrid.SelectedDataKeys[0].Tostring());
2) Convert.ToInt32(Datagrid.SelectedDataKeys["Datafield Name"].Tostring());


  • If Datakey is given to Datagrid and not Selected

Convert.ToInt32(Datagrid.DataKeys[0][“Column name”].Tostring());

  • If Columns are given to Datagrid

 Datagrid.Rows[0].Cells[3].Text;


  • Check if Column Name is Result

If (Dataset.Tables[0].Columns[0].ColumnName==”Result”);

  • Count No of Tables in Dataset

Dataset.Tables.Count==2

  • Count No of Rows in a table of Dataset

Dataset.Tables[0].Rows.Count

  • Count No of Rows in a Datagrid

Datagrid.Rows.Count


  • Get the value of Dataset
Dataset.Tables[0].Rows[0]["Datafield Name"].Tostring();


  • .Add the below code in the html where you want to output the year

<%=DateTime.Now.Year%>

Comments

Popular posts from this blog

How to retain the data annotations or class during modify a table in the database

Interview Questions

AJAX CONTROL