Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
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
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 20-Apr-13 4:30am
Comments
Sandeep Mewara at 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 at 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 at 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 at 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
0 OriginalGriff 445
1 Sergey Alexandrovich Kryukov 322
2 Maciej Los 275
3 CHill60 195
4 King Fisher 179
0 OriginalGriff 240
1 Maciej Los 95
2 Sascha Lefévre 85
3 King Fisher 70
4 F-ES Sitecore 55


Advertise | Privacy | Mobile
Web01 | 2.8.150331.1 | Last Updated 20 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100