Grid view controls with Manipulations

Posted by karunakar5788-15015 under ASP.NET on 4/17/2012 | Points: 10 | Views : 1820 | Status : [Member] | Replies : 3
Hi,

am new to .net technology..

i want to know how to navigate the fields in Gridview.

i had the data in GridView but i want to navigate in the data to another page.






Regards,
Karunakar

Karunakar


Responses

Posted by: Sunny4989 on: 4/17/2012 [Member] Starter | Points: 25

Up
0
Down
Using QueryString

------------------------------------------------
Learn throughout life

karunakar5788-15015, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gsm_Gsv on: 4/17/2012 [Member] Starter | Points: 25

Up
0
Down
In the row command event of gridview, append the javascript and add a query string that should go to next page


Dim strNewPage as New StringBuilder
With strNewPage
.Append("RetVal = window.showModalDialog('NewPage.aspx?field= " + Gridview1.rows(index).Cells(0).Text + "');")
End With


Change the Cell position appropriately.

Hope this will help you


--
Regards
Madhu


---------------------------------------
Live the life you've dreamed

Regards
MADHU

karunakar5788-15015, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Veerac85 on: 4/17/2012 [Member] Starter | Points: 25

Up
0
Down
you can do this programmatically in the rowcreated event of the gridview.

Add a buttonfieldcolumn to the gridview
<asp:buttonfield buttontype="Button"
commandname="Select"
headertext=""
text="Select"/>

Once user clicks on the select button, you can redirect him to the page you want
public void ProductsView_RowCommand(Object sender, GridViewCommandEventArgs e)
{
// If multiple ButtonField column fields are used, use the
// CommandName property to determine which button was clicked.
if (e.CommandName == "Select")
{
// Convert the row index stored in the CommandArgument
// property to an Integer.
int index = Convert.ToInt32(e.CommandArgument);

// Get the product id of the selected product
GridViewRow selectedRow = gvProducts.Rows[index];
string ID = gvProducts.DataKeys[index].Value.ToString();

//Redirect the user to product detail view page
Server.Transfer("ProductDetailView.aspx?ProductID=" + ID);
}
}

You will find the complete example at http://technico.qnownow.com/2012/03/28/using-gridview-in-asp-net-c-part-2/

karunakar5788-15015, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response