Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

I want to Pass Grid view cells data to user control text boxes.

Suppose the gridview cell data like
i=gridview1.currentrow.index
obj.pid=gridview1.rows[i].value.tostring();

I passed these values using properties.

The user control have text boxes, (user control is in another form) and i wrote property like

public string pid
{
set{textbox1.text=vaalue;}
get{return textbox1.text}
}

i created user control run time and added but come with empty textboxes

why?


please help me


thanks

venkat
Posted
Updated 1-Dec-10 0:43am
v5
Comments
Dalek Dave 1-Dec-10 6:30am    
Edited for Grammar and Readability.

txtboxFName.Text = DgvEmployee.Rows[DgvEmployee.SelectedRows[0].Index].Cells[0].Value.ToString();
txtboxFName is the name of textbox and DgvEmployee is the name of datagrid view.
use it, it gives the value of 0th cell of 0th row to the textbox .
:)
 
Share this answer
 
//In user control
private int m_minValue;
public int MinValue
{
    get
    {
        return m_minValue;
    }
    set
    {
        m_minValue = value;
    }
}
//In Page
MinValue = gridview1.currentrow.index;
//Pass the MinValue value to textbox.
 
Share this answer
 
Comments
Dalek Dave 1-Dec-10 6:31am    
Good Answer.
m@dhu 1-Dec-10 6:40am    
Thanks DD.

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



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