Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to edit individual cells in gridview,what exactly i need is when i click on the cell in the gridview it must open a popup webpage.

Please help me...

Thanks in advance.......

Thanks,
Kiran
Posted

Hi,

Change the field to a template field, add a linkbutton control.
Bind the text of the linkbutton to the original column.

Then double click on the link button which will create a serverside method where you get the required field value like shown below.

string key = ((LinkButton)sender).Text;
You can then server.transfer with the key

Another way is to create a javascript statement that loads the second page client side.

You can do this by using the following method
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

Then add an attribute to the linkbutton which calls javascript to open the form.
LinkButton1.Attributes.Add("onclick", "... javascript to load page... " + key)

hope this points you in a good direction...

regards,

Don
 
Share this answer
 
Hi,

I tried some code for your requirement.check this once

In your data control place below code
ASP.NET
<td onclick="f1(this,<%#Eval("compid") %>)">
                       <asp:label id="Lbluid" runat="server" text="<%#Eval("compid") %>" xmlns:asp="#unknown"></asp:label>
                   </td>


It can be add from design side or databound event.

And the javascript tag contains following code
JavaScript
function f1(tid, asr) {
      //alert("your selected company ID is :"+asr+"; Selected Cell value is :"+tid.innerText);
           $('#basic-modal-content').modal();
           $("#preval").html(tid.innerText);
           $("#hdncid").text(asr);
       }
       function updatval() {
           $.post("page.aspx?action=modify", { id: $("#preval").val(), val: $("#txtcrtval").val() }, function (data) {

           });
       }


In the above code tid.innerText means values of that cell
And asr means id of that row data.In my emaple company id is asr.

I update that cell using asr only that means companyid.

you can add to dts in datacontrol so you can retrieve
I hope you'll understood what I said

All the Best
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900