0

here I am trying to hide the column in the datagrid, the column is:

<asp:BoundField HeaderText="Transaction Category ID" DataField="TransactionCategoryID"
   ItemStyle-CssClass="gridview_item_center" visible="false"/>

but the problem is, when I try to get the data (in javascript function below), while the datagrid column is hidden it acts like it doesn't exist, so the value returned is wrong, is there any alternate solution to just simply hide the column but the value is still acceptable?

the javascript (should it needed):

      function ShowAddDialog(lnkTransactionID) {
      if (lnkTransactionID != null) {
          //alert("ID:" + $(lnkTransactionID)[0].innerHTML);

          var td = lnkTransactionID.parentElement;
          var transactionCategory = $(td.nextSibling)[0].innerHTML;
          var transactionDesc = $(td.nextSibling.nextSibling.nextSibling)[0].innerHTML;

          $("[id$='lblTransactionID']").text($(lnkTransactionID)[0].innerHTML);
          $("[id$='hfTransactionID']").val($(lnkTransactionID)[0].innerHTML);
          $("[id$='ddlTransactionCategoryInput']").val(transactionCategory);
          $("[id$='txtTransactionDescInput']").val(transactionDesc);
      }
      $("#divDialog").dialog("open");
  }
4

1 回答 1

1

当您将可见性设置为 false 时,它​​不会在 HTML 中呈现,因此会出现错误。

使用带有 display:none 的 css 类,看看它是否有帮助。

示例 css 类如下所示:

.classHiddden
 {display:none;}

然后将此类分配给您要隐藏的控件。

谢谢,

于 2013-06-25T09:02:55.223 回答