Click here to Skip to main content
15,922,155 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_14-Jun-06 20:41
_AK_14-Jun-06 20:41 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane14-Jun-06 20:45
varshavmane14-Jun-06 20:45 
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_14-Jun-06 20:49
_AK_14-Jun-06 20:49 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane14-Jun-06 21:00
varshavmane14-Jun-06 21:00 
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_14-Jun-06 21:22
_AK_14-Jun-06 21:22 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane14-Jun-06 22:17
varshavmane14-Jun-06 22:17 
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_14-Jun-06 22:37
_AK_14-Jun-06 22:37 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane14-Jun-06 22:46
varshavmane14-Jun-06 22:46 
Hi,

As u said I made the changes in the code but its giving compile time error saying "The name 'dt' does not exist in the class or namespace".I am copied the below:

private void ibtnAdd_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
Classes.CChecklist cchecklist = new Classes.CChecklist();
dgChecklist.AutoGenerateColumns = true;
int cnt;
if(lbISOClauseNo.Items.Count > 0 && lbISODesc.Items.Count > 0 && txtExpected.Text != "" && txtTimeAllocated.Text != "")
{
for(cnt = 0 ; cnt < lbISOClauseNo.Items.Count ; cnt++)
{
if(cnt == lbISOClauseNo.Items.Count -1)
{
htxtFISOClauseNo.Value += lbISOClauseNo.Items[cnt].Value;
htxtFISOClauseDesc.Value += lbISODesc.Items[cnt].Value;
}
else
{
htxtFISOClauseNo.Value += lbISOClauseNo.Items[cnt].Value + "," ;
htxtFISOClauseDesc.Value += lbISODesc.Items[cnt].Value + "," ;
}
}
htxtFExpected.Value = txtExpected.Text;
htxtFTimePlanned.Value = txtTimeAllocated.Text;
cnt = Int32.Parse(htxtFChecklistNo.Value);
cnt++;
htxtFChecklistNo.Value = cnt.ToString();
}
if(ViewState["dtbl"]!=null)
{
//Datatable is available in viewstate.
DataRow dr = dt.NewRow();
dr["Checklist No"] = htxtFChecklistNo.Value;
dr["ISO Clause No"] = htxtFISOClauseNo.Value;
dr["Activities"] = htxtFISOClauseDesc.Value;
dr["Expected"] = htxtFExpected.Value;
dr["Time Allocated"] = htxtFTimePlanned.Value;

dt.Rows.Add(dr);
}
else
{
DataTable dt = new DataTable("CheckList");
//Checklist No
DataColumn dc = new DataColumn();
dc = dt.Columns.Add("Checklist No",System.Type.GetType("System.Int32"));
dc.Caption = "checklist_no";

//ISO Clause No
dc = dt.Columns.Add("ISO Clause No",System.Type.GetType("System.String"));
dc.Caption = "checklist_isoclause";

//Activities
dc = dt.Columns.Add("Activities",System.Type.GetType("System.String"));
dc.Caption = "checklist_activities";

//Expected Evidence
dc = dt.Columns.Add("Expected",System.Type.GetType("System.String"));
dc.Caption = "checklist_expected";

//Time Planned
dc = dt.Columns.Add("Time Allocated",System.Type.GetType("System.String"));
dc.Caption = "checklist_timeplanned";
ViewState["dtbl"] = dt;

DataRow dr = dt.NewRow();
dr["Checklist No"] = htxtFChecklistNo.Value;
dr["ISO Clause No"] = htxtFISOClauseNo.Value;
dr["Activities"] = htxtFISOClauseDesc.Value;
dr["Expected"] = htxtFExpected.Value;
dr["Time Allocated"] = htxtFTimePlanned.Value;

dt.Rows.Add(dr);
}
dgChecklist.DataSource = dt;
dgChecklist.DataBind();
}

Please help me...

Thanks and regards
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_14-Jun-06 22:58
_AK_14-Jun-06 22:58 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane14-Jun-06 23:09
varshavmane14-Jun-06 23:09 
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_14-Jun-06 23:10
_AK_14-Jun-06 23:10 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane14-Jun-06 23:21
varshavmane14-Jun-06 23:21 
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_15-Jun-06 0:37
_AK_15-Jun-06 0:37 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane15-Jun-06 0:48
varshavmane15-Jun-06 0:48 
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_15-Jun-06 1:13
_AK_15-Jun-06 1:13 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane15-Jun-06 1:25
varshavmane15-Jun-06 1:25 
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_15-Jun-06 1:33
_AK_15-Jun-06 1:33 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane15-Jun-06 1:46
varshavmane15-Jun-06 1:46 
Questionasp.net application with recordset Pin
Sameer Salkar14-Jun-06 17:54
Sameer Salkar14-Jun-06 17:54 
QuestionHyperlinkcolumn - change color of link Pin
NewbieDave14-Jun-06 12:04
NewbieDave14-Jun-06 12:04 
AnswerRe: Hyperlinkcolumn - change color of link Pin
minhpc_bk14-Jun-06 16:18
minhpc_bk14-Jun-06 16:18 
Questionwhich is better ? Pin
anj198314-Jun-06 9:10
anj198314-Jun-06 9:10 
AnswerRe: which is better ? Pin
Elina Blank14-Jun-06 9:27
sitebuilderElina Blank14-Jun-06 9:27 
QuestionDatagrid; using multiple tables and getting blank row Pin
leckey14-Jun-06 8:45
leckey14-Jun-06 8:45 
AnswerRe: Datagrid; using multiple tables and getting blank row Pin
ToddHileHoffer14-Jun-06 9:07
ToddHileHoffer14-Jun-06 9:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.