c# - Clickable row in GridView and edit the row -


i have problem here regarding editable gridview. want replacing edit button function using single clickable row. when click row, should forwarding me new page editing row data. how can achieve this, without using edit button?

protected void gridview1_rowcreated(object sender, gridviewroweventargs e) {     // apply changes if datarow      if (e.row.rowtype == datacontrolrowtype.datarow)     {          // when mouse on row, save original color new attribute, , change highlight yellow color          e.row.attributes.add("onmouseover",         "this.originalstyle=this.style.backgroundcolor;this.style.backgroundcolor='#eeff00'");            // when mouse leaves row, change bg color original value             e.row.attributes.add("onmouseout",         "this.style.backgroundcolor=this.originalstyle;");                  } } protected void gridview1_rowdatabound(object sender, gridviewroweventargs e) {     if (e.row.rowtype == datacontrolrowtype.datarow)     {         string abc = ((gridview)sender).datakeys[e.row.rowindex].value.tostring();         e.row.attributes["onclick"] = "location.href='default.aspx?id=" + abc + "'";         //e.row.attributes["onclick"] = "location.href='default.aspx?id=" + databinder.eval(e.row.dataitem, "categoryid") + "'";                   e.row.attributes.add("style", "cursor:pointer;");      }  } 

simply add controls want default.aspx , on default.aspx pageload event(in not postback condition) retrieve record through id , populate controls.

now when submit button pressed update record , redirect original page


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -