How to fill Textbox by gridview row by clicking Edit button

Posted by Anweshabhowmick under Regular Expressions on 4/15/2011 | Points: 10 | Views : 12392 | Status : [Member] | Replies : 5
How to fill Text Box by clicking the Gridview command button.....

acttually i want to fill the all the text boxs by clicking command button "View".......
in my gridview there are 5 rows and i want that after clicking view button all the rows of the grid view fill corresponding textbox



can any one help me..




Responses

Posted by: Sutotpal on: 4/15/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,
You can write it like this if you have view or edit event with a link buton in the gridview, else in the gridview editing, or in the gridview rowcommand

protected void View(object sender, EventArgs e)

{
using (GridViewRow row = (GridViewRow)((LinkButton)sender).Parent.Parent)
{
txtEmployeeID.Text = row.Cells[0].Text;
txtEmployeeContactName.Text = row.Cells[1].Text;
txtEmployeeCompany.Text = row.Cells[2].Text;
}
}


Best Regards,
Sutotpal

Anweshabhowmick, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 4/15/2011 [Member] Starter | Points: 25

Up
0
Down
hi..

You can try this....write this code in button click event

txtbox1.text=grdconfig.item(0,1).value

txtbox2.text=grdconfig.item(0,2).value
txtbox3.text=grdconfig.item(0,3).value
txtbox4.text=grdconfig.item(0,4).value

http://vbdotnetaddict.blogspot.com

Anweshabhowmick, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Srinivas673 on: 4/16/2011 [Member] Starter | Points: 25

Up
0
Down

<asp:TemplateField HeaderText="PromoCodeDesc" SortExpression="PromoCodeDesc">
<ItemTemplate>
<asp:Label ID="lblPromoCodeDesc" Text=' <%# Eval("PromoCodeDesc")%>' runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtPromoCodeDesc" runat="server" Columns="30" Text='<%# Eval("PromoCodeDesc")%>' /
</EditItemTemplate>
</asp:TemplateField>
//in Edit item template take textbox ,text is bind what u bind in grid.
otherwise u find out taht textbox is some what lengthy

Anweshabhowmick, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Srinivas673 on: 4/16/2011 [Member] Starter | Points: 25

Up
0
Down
You bind Text property that works our application i am use like above

Anweshabhowmick, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 4/16/2011 [Member] Starter | Points: 25

Up
0
Down
Hi...
Try this link it may helpful to you .....
http://vbdotnetaddict.blogspot.com/2011/02/groid-view-load-and-update-sql-data.html

Anweshabhowmick, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response