In my case I am retrieving some data from the backend.
In that one particular column in the gridview should be hidden. It should not be shown on the screen. In case if is use visible=”false” the data is not showing in when clicking the event the text box how to do this please help me.
Source code:
<asp:BoundField DataField="GLAC_NAME" HeaderText="A/cNo">
<ItemStyle Width="200px" />
</asp:BoundField>
This particular column I have to hide should not shown to the user
Code begin:
protected void GridLedger_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onMouseDown", "var str = document.getElementById('" + e.Row.ClientID + "').cells[1].innerText; document.getElementById('"+TextBox1.ClientID+"').value = str;");
}
}
catch (System.Exception ex)
{
throw ex;
}
}
Here is the code begin in this what I should mention in cell value
When you use visible=false then it won’t render the html to the browser so your javascript won’t work. You should try setting a css attribute to hide it instead: display:none;