Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
string frm = ((DropDownList)gv_rap.Rows[i].Cells[12].FindControl("ddlfrm")).Text.Trim();
                   string to = ((DropDownList)gv_rap.Rows[i].Cells[13].FindControl("ddlto")).Text.Trim();


above code display record.

but textbox doesn't show value in textbox when click on add button griedview
C#
string frm = ((Textbox)gv_rap.Rows[i].Cells[12].FindControl("ddlfrm")).Text.Trim();
                   string to = ((Textbox)gv_rap.Rows[i].Cells[13].FindControl("ddlto")).Text.Trim();
Posted
Comments
Sandeep Mewara 20-Apr-13 11:00am    
Are there dropdown and textbox (2 controls) in Cell[12] ? If not then why are you casting that cell control?
anghan22 21-Apr-13 3:09am    
i have use textbox cells[12] but doesn't display value when click on imahe button on gried view
anghan22 21-Apr-13 3:12am    
if (e.CommandName == "select")
{

for (int i = 0; i < gv_rap.Rows.Count; i++)
{
var color = ((Label)gv_rap.Rows[i].Cells[3].FindControl("lblcolor")).Text.Trim(); //If its label
var cl = ((Label)gv_rap.Rows[i].Cells[4].FindControl("lblclearity")).Text.Trim();
var shape = ((Label)gv_rap.Rows[i].Cells[7].FindControl("lblshape")).Text.Trim();
string frm = ((DropDownList)gv_rap.Rows[i].Cells[12].FindControl("ddlfrm")).Text.Trim();
string to = ((DropDownList)gv_rap.Rows[i].Cells[13].FindControl("ddlto")).Text.Trim();

TextBox txtrap = ((TextBox)gv_rap.Rows[i].Cells[14].FindControl("txtrap"));
string str = "select rap from test where frm='" + frm+ "'and tom='" + to + "'and round='" + shape + "'and clearity='" + cl + "'and color= '" + color + "'";
SqlCommand cmd = new SqlCommand(str, conn);
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();

if (reader.Read())
{

txtrap.Text= reader["rap"].ToString();

reader.Close();

conn.Close();
}

}
anghan22 21-Apr-13 3:15am    
above my code when click onsingle time select image button at that time all row in griedview
change value in txtrap field griedview textbox...

i have to one by one get value in txtrap taxtbox...

please help..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900