Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is my code.

foreach (GridViewRow row in GridViewSys.Rows)
            {
                if (row.RowIndex == GridViewSys.SelectedIndex)
                {
                    row.BackColor = ColorTranslator.FromHtml("#beddff");
                    row.ToolTip = String.Empty;

                    String sysName, sysDesc, sysVen, sysReq, sysPO, sysLT, sysSOW, sysSLA, sysComp, sysSQ;
                    sysName = row.Cells[0].Text;
                    sysDesc = row.Cells[1].Text;
                    sysVen = row.Cells[2].Text;
                    sysReq = row.Cells[3].Text;
                    sysPO = row.Cells[4].Text;
                    sysLT = row.Cells[5].Text;
                    sysSOW = row.Cells[6].Text;
                    sysSLA = row.Cells[7].Text;
                    sysComp = row.Cells[8].Text;
                    sysSQ = row.Cells[9].Text;

                    txtSysName.Text = sysName;
                    txtSysDesc.Text = Server.HtmlEncode(sysDesc);
                    txtVendorName.Text = sysVen;
                    txtRequisition.Text = sysReq;
                    txtPO.Text = sysPO;
                    ddlLicenseType.SelectedValue = sysLT;
                    // LinkButtons
                    linkBSOW.Text = sysSOW;
                    linkBSAL.Text = sysSLA;
                    linkBComp.Text = sysComp;
                    linkBSQ.Text = sysSQ;
                }
                else
                {
                    row.BackColor = ColorTranslator.FromHtml("#FFFFFF");
                    row.ToolTip = "Click to select this row.";
                }


What I have tried:

Search the internet for answer but no luck.
Posted
Updated 10-Jul-22 22:26pm
Comments
Richard MacCutchan 11-Jul-22 4:24am    
sysName = row.Cells[0].Text;
txtSysName.Text = sysName;

Why not just:
txtSysName.Text = row.Cells[0].Text;


Also, you have not explained what your problem is.
Member 15627495 11-Jul-22 4:45am    
By UX, and for a good shortcut,

you might build 'clickable gridview cells', instead of bring 'links' as one more purposes.
you'll like 'lightweight' and rich content of your cells in your app.

to achieve :
add the event 'click' on each data you display in cells ( one event for each cells ).

1 solution

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