|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Need Help in creating a HyperlinkButton in Datagridis have this button link to another page. The button must also pass an ID to the next page. this is wht i coded in the code behind. Where " +e.Item.Cells[0].Text); " is pointing to an invisble Bound column with a Data field named i_ComponentSetupId ( tht is the id thts its supposed to pass to the next page). Hmm, it aint working. I'm new to programming, i wonder if anyone can show me any examples? Thx in advance people. private void DataGridComponentProcesses_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { Response.Redirect("EditComponentSetup.aspx?id="+ e.Item.Cells[0].Text); } One last thing guys, How should i code it if i have another in the same grid
linking to another page? How do i define which button is for which link? Thx guys. Show quoteHide quote "Faizal Tan" <fai***@crimsonworks.com.sg> wrote in message news:%23%23Cu6FXGFHA.392@TK2MSFTNGP14.phx.gbl... > Hi guys, i have a problem with my button in my datagrid. Wht i need to do > is have this button link to another page. The button must also pass an ID > to the next page. this is wht i coded in the code behind. > > Where " +e.Item.Cells[0].Text); " is pointing to an invisble > Bound column with a Data field named i_ComponentSetupId ( tht is the id > thts its supposed to pass to the next page). > > Hmm, it aint working. I'm new to programming, i wonder if anyone can show > me any examples? > Thx in advance people. > private void DataGridComponentProcesses_ItemCommand(object source, > System.Web.UI.WebControls.DataGridCommandEventArgs e) > > { > > Response.Redirect("EditComponentSetup.aspx?id="+ e.Item.Cells[0].Text); > > } > > > > > > Hi Faizal,
Basically Response.Redirect("EditComponentSetup.aspx?id="+ e.Item.Cells[0].Text); is right. But question is the column index. You try to take a value from the first column. I suppose you might use the first, or even the second, columns as click buttons. In that case, you should use e.Item.Cells[2].Text (or may other, you should figure out). In order to distinguish button, you have to assign CommandName for each button. Then you can If (e.CommandName == CommandBtnOne){ // go to page one return; } If (e.CommandName == CommandBtnTwo){ // go to page two return; } HTH Elton Wang elton_w***@hotmail.com >-----Original Message----- another in the same grid >One last thing guys, How should i code it if i have >linking to another page? How do i define which button is for which link?>Thx guys. datagrid. Wht i need to do > > >"Faizal Tan" <fai***@crimsonworks.com.sg> wrote in message >news:%23%23Cu6FXGFHA.392@TK2MSFTNGP14.phx.gbl... >> Hi guys, i have a problem with my button in my >> is have this button link to another page. The button must also pass an ID >> to the next page. this is wht i coded in the code to an invisble behind. >> >> Where " +e.Item.Cells[0].Text); " is pointing >> Bound column with a Data field named i_ComponentSetupId ( tht is the id >> thts its supposed to pass to the next page). if anyone can show >> >> Hmm, it aint working. I'm new to programming, i wonder >> me any examples? e.Item.Cells[0].Text);>> Thx in advance people. >> private void DataGridComponentProcesses_ItemCommand (object source, >> System.Web.UI.WebControls.DataGridCommandEventArgs e) >> >> { >> >> Response.Redirect("EditComponentSetup.aspx?id="+ Show quoteHide quote >> >> } >> >> >> >> >> >> > > >. > Thx Elton, tht worked and I found out actually tht in the property box of
the grid, it actually didn't connect to the item command tht I double clicked in the first place. I merely select it back again and it worked. Thx for your help and have a great day! Show quoteHide quote "Faizal Tan" <fai***@crimsonworks.com.sg> wrote in message news:%23%23Cu6FXGFHA.392@TK2MSFTNGP14.phx.gbl... > Hi guys, i have a problem with my button in my datagrid. Wht i need to do > is have this button link to another page. The button must also pass an ID > to the next page. this is wht i coded in the code behind. > > Where " +e.Item.Cells[0].Text); " is pointing to an invisble > Bound column with a Data field named i_ComponentSetupId ( tht is the id > thts its supposed to pass to the next page). > > Hmm, it aint working. I'm new to programming, i wonder if anyone can show > me any examples? > Thx in advance people. > private void DataGridComponentProcesses_ItemCommand(object source, > System.Web.UI.WebControls.DataGridCommandEventArgs e) > > { > > Response.Redirect("EditComponentSetup.aspx?id="+ e.Item.Cells[0].Text); > > } > > > > > >
DataGrid for Data Entry
Template column base on another column value getting the data for dynamically for Datagrid Conditionally set dataGrid Rows backcolor aspx, word question How to properly Format zip code in a datagrid REPOST: MSDN UNIVERSAL NG SUPPORT, WHERE ARE YOU? Call windows apps from web apps dropdownlist in datagrid How to add javascript onClick attribute to datagrid's edit template (update command)? |
|||||||||||||||||||||||