C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

DataGrid values automatically disappear


Posted Date: 05 May 2007      Posted By: Ajay kumar      Member Level: Gold     Points: 2   Responses: 0



I have set the property of datagrid autogenerated column=false and i m creating columns like
<asp:TemplateColumn HeaderText="Emp ID"> and using <item template>

First column i have created as check boxes

now i have 10 rows and when i click the first checkbox i set the 3 column value of datagrid with System Time.
Now when i click the second check box my first value in the datagrid gets disappear.

i m using following code

private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
foreach (DataGridItem i in DataGrid1.Items)
{
CheckBox cBox = (CheckBox) i.FindControl("SelectCheckBox");
cBox.CheckedChanged += new EventHandler(OnChangeHandler);
}}
protected void OnChangeHandler(object sender, System.EventArgs e)
{
CheckBox rb = new CheckBox();
string TIME=System.DateTime.Now.ToShortTimeString();
foreach (DataGridItem i in DataGrid1.Items)
{
rb = (CheckBox) i.FindControl("SelectCheckBox");
if(rb.Checked==true && rb.Enabled==true)
{
rb.Enabled=false;
i.Cells[3].Text=TIME.Trim();
}}
Please help i want my previous value to remain thr





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Post Reply
You must Sign In to post a response.
Next : How to select treenode by javascript?
Previous : What is Overlays ?
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use