i m new in asp .net...
i m making a form in which i am using the textbox, radiobutton list,dropdownlist,button and grid view....
when i click on the button then all the data which is in textbox,radiobuttonlist and dropdownlist are entered into the database and show into the gridview....
in gridview i take a select or delete button.
now i want that when i click on the select button of grid view then the selected row data can populate on other form i textboxes....
plzzzzzzzzzzzz....
help me........

Madhu KRank #1,514 · 1.1K reputationPosted Nov 25, 2010, 3:45 AM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 23, 2010, 8:59 PM EST
On Button click event Insert the textbox text, radiobuttonlist and dropdownlist values into db.
get the inserted values from db and bind it to gridview.
Use the button in item template of gridview and redirect to new page with the ID.
using the ID get the values from db and fill the text boxes.
Rahul Goyal52 reputationPosted Nov 23, 2010, 9:08 PM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 23, 2010, 9:40 PM EST
Instead of the command field use asp:TemplateField ShowHeader="False"> ItemTemplate> asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" CommandArgument="" Text="Select">asp:LinkButton> ItemTemplate> asp:TemplateField> protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { LinkButton lnk = (LinkButton)FindControl("LinkButton1"); if (e.CommandName == "edit") { Response.Redirect("Default.aspx?id"+ e.CommandArgument); //e.CoomandArgument is id. } }In default2.aspx pageload
int id =Convert.ToInt32(Request.QueryString["id"]);
use datareader to get the values of the row based on id.
Rahul Goyal52 reputationPosted Nov 23, 2010, 11:20 PM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 23, 2010, 11:42 PM EST
You can use Button instead of link button.
Rahul Goyal52 reputationPosted Nov 25, 2010, 1:57 AM EST
Rahul Goyal52 reputationPosted Nov 25, 2010, 6:29 PM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 25, 2010, 6:36 PM EST
Rahul Goyal52 reputationPosted Nov 25, 2010, 8:53 PM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 25, 2010, 9:22 PM EST
txtempcode.Text=dr["Emp_code"].ToString();
Rahul Goyal52 reputationPosted Nov 25, 2010, 10:20 PM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 25, 2010, 10:43 PM EST
Place a break point at this part of code and check whether this executing? protected void gv_RowCommand(object sender, GridViewCommandEventArgs e) { LinkButton lnk = (LinkButton)FindControl("LinkButton1"); if (e.CommandName == "edit") { Response.Redirect("Default.aspx?id"+ e.CommandArgument); //e.CoomandArgument is id. }Rahul Goyal52 reputationPosted Nov 25, 2010, 10:54 PM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 25, 2010, 11:30 PM EST
BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4"
DataKeyNames="Emp_code" DataSourceID="SqlDataSource1" Height="154px"
Width="670px" onrowcommand="gv_RowCommand">
Rahul Goyal52 reputationPosted Nov 25, 2010, 11:38 PM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 25, 2010, 11:54 PM EST
Go to design mode Gridview properties events on top double click on rowcommand event Following event is firedprotected void gv_RowCommand(object sender, GridViewCommandEventArgs e)
{
}
Place the code in above.
Rahul Goyal52 reputationPosted Nov 26, 2010, 12:03 AM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 26, 2010, 12:30 AM EST
Rahul Goyal52 reputationPosted Nov 26, 2010, 1:24 AM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 26, 2010, 2:18 AM EST
Rahul Goyal52 reputationPosted Nov 26, 2010, 2:29 AM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 26, 2010, 2:50 AM EST
Rahul Goyal52 reputationPosted Nov 26, 2010, 3:06 AM EST