Click here to Skip to main content
15,915,864 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Sample Asp.net application Pin
umashankergr86-Mar-07 19:09
umashankergr86-Mar-07 19:09 
Questionimage views Pin
vamsivs2-Mar-07 5:02
vamsivs2-Mar-07 5:02 
AnswerRe: image views Pin
Frank Kerrigan2-Mar-07 5:57
Frank Kerrigan2-Mar-07 5:57 
QuestionRedirecting parent page Pin
Khan.Bangash2-Mar-07 4:57
Khan.Bangash2-Mar-07 4:57 
AnswerRe: Redirecting parent page Pin
Guffa2-Mar-07 8:26
Guffa2-Mar-07 8:26 
AnswerRe: Redirecting parent page Pin
Haissam3-Mar-07 14:08
Haissam3-Mar-07 14:08 
QuestionRole Management Pin
Sarfaraj Ahmed2-Mar-07 4:30
Sarfaraj Ahmed2-Mar-07 4:30 
QuestionRadioButtonList&Datagrid Pin
nclauder2-Mar-07 4:21
nclauder2-Mar-07 4:21 
Hi,
Ihave a datagrid that Insert data in some rows. One column has RadioButtonList that contains three Items. But When I select one radiobuton, insert data in other columns and select insert data The radio button unselects itself. Why would this be happening? here is my code.

DataTable table = new DataTable();
private DataTable Fill()
{
SqlDataAdapter adapter = new SqlDataAdapter("select * from dbo.DashBoard", con);
adapter.Fill(table);
return table;
}
private void Bind()
{
dgis.DataSource = table;
dgis.DataBind();
}
private void InsertEmpty()
{
table.Rows.InsertAt(table.NewRow(), 0);
}
private void dgis_ItemCommand(object source,System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// stop editing
dgis.EditItemIndex = -1;

switch (e.CommandName)
{
case "Insert":
//dgis.EditItemIndex = e.Item.ItemIndex;
break;

case "Update":
System.Web.UI.WebControls.TextBox st=new System.Web.UI.WebControls.TextBox();
st=(System.Web.UI.WebControls.TextBox)e.Item.Cells[5].FindControl("txtobjach");
System.Web.UI.WebControls.TextBox st1=new System.Web.UI.WebControls.TextBox();
st1=(System.Web.UI.WebControls.TextBox)e.Item.Cells[4].FindControl("txtobj");
System.Web.UI.WebControls.TextBox st2=new System.Web.UI.WebControls.TextBox();
st2=(System.Web.UI.WebControls.TextBox)e.Item.Cells[3].Controls[0];
System.Web.UI.WebControls.TextBox st3=new System.Web.UI.WebControls.TextBox();
st3=(System.Web.UI.WebControls.TextBox)e.Item.Cells[2].Controls[0];
System.Web.UI.WebControls.TextBox st4=new System.Web.UI.WebControls.TextBox();
st4=(System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0];
System.Web.UI.WebControls.RadioButtonList st5=new System.Web.UI.WebControls.RadioButtonList();
st5=(System.Web.UI.WebControls.RadioButtonList)e.Item.Cells[0].FindControl("rblmood");
SqlCommand myCommand=new SqlCommand();
myCommand.Connection=con;
myCommand.CommandText="insert into DashBoard (ObjectiveAchieved,Objective) values (@ObjectiveAchieved, @Objective)";
myCommand.Parameters.Add(new SqlParameter("@ObjectiveAchieved",SqlDbType.Text));
myCommand.Parameters["@ObjectiveAchieved"].Value=st.Text;
myCommand.Parameters.Add(new SqlParameter("@Objective",SqlDbType.Text));
myCommand.Parameters["@Objective"].Value=st1.Text;
myCommand.Parameters.Add(new SqlParameter("@Workinghrs",SqlDbType.Char,45));
myCommand.Parameters["@Workinghrs"].Value=st2.Text;
myCommand.Parameters.Add(new SqlParameter("@Loggedout",SqlDbType.Char,45));
myCommand.Parameters["@Loggedout"].Value=st3.Text;
myCommand.Parameters.Add(new SqlParameter("@Loggedin",SqlDbType.Char,45));
myCommand.Parameters["@Loggedin"].Value=st4.Text;
myCommand.Parameters.Add(new SqlParameter("@MoodToday",SqlDbType.Text));
myCommand.Parameters["@MoodToday"].Value=st5.DataValueField;
con.Open();
myCommand.ExecuteNonQuery();
con.Close();
dgis.EditItemIndex=-1;
BindDataGrid();
break;

case "Cancel":
break;

case "Edit":
// begin editing
dgis.EditItemIndex = e.Item.ItemIndex;
EditCommandColumn ecc = (EditCommandColumn) dgis.Columns[6];
ecc.UpdateText = "Insert";
//dgis.EditItemIndex = e.Item.ItemIndex;
break;
}
// fill and bind
Fill();
InsertEmpty();
Bind();
}

Thanks.
QuestionCall javascript class methods from aspx page Pin
breen252-Mar-07 3:26
breen252-Mar-07 3:26 
AnswerRe: Call javascript class methods from aspx page Pin
badgrs2-Mar-07 4:30
badgrs2-Mar-07 4:30 
AnswerRe: Call javascript class methods from aspx page Pin
Guffa2-Mar-07 5:48
Guffa2-Mar-07 5:48 
GeneralRe: Call javascript class methods from aspx page Pin
breen255-Mar-07 1:25
breen255-Mar-07 1:25 
AnswerRe: Call javascript class methods from aspx page Pin
Guffa5-Mar-07 4:08
Guffa5-Mar-07 4:08 
GeneralRe: Call javascript class methods from aspx page Pin
breen255-Mar-07 5:54
breen255-Mar-07 5:54 
AnswerRe: Call javascript class methods from aspx page Pin
Guffa5-Mar-07 8:10
Guffa5-Mar-07 8:10 
GeneralRe: Call javascript class methods from aspx page Pin
breen257-Mar-07 2:18
breen257-Mar-07 2:18 
QuestionCan not find OpenFileDialog control in the Web application Pin
rockxuyenmandem2-Mar-07 3:18
rockxuyenmandem2-Mar-07 3:18 
AnswerRe: Can not find OpenFileDialog control in the Web application Pin
badgrs2-Mar-07 4:27
badgrs2-Mar-07 4:27 
AnswerRe: Can not find OpenFileDialog control in the Web application Pin
Vasudevan Deepak Kumar4-Mar-07 2:10
Vasudevan Deepak Kumar4-Mar-07 2:10 
QuestionTAX RATES Pin
tedhill132-Mar-07 1:27
tedhill132-Mar-07 1:27 
AnswerRe: TAX RATES Pin
Chris Buckett2-Mar-07 9:54
Chris Buckett2-Mar-07 9:54 
QuestionTree View Control Pin
varshavmane2-Mar-07 1:23
varshavmane2-Mar-07 1:23 
AnswerRe: Tree View Control Pin
Sathesh Sakthivel2-Mar-07 1:46
Sathesh Sakthivel2-Mar-07 1:46 
QuestionFocus for Div tag Pin
sparkling star2-Mar-07 1:02
sparkling star2-Mar-07 1:02 
AnswerRe: Focus for Div tag Pin
Chris Buckett2-Mar-07 5:53
Chris Buckett2-Mar-07 5:53 

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.