1
Answer

how to enable button click on any node in treeview in asp.n

Photo of Anjali Khan

Anjali Khan

7y
224
1
Hi frnds
how to enable button click on any node in treeview in asp.net ?
when i click on tree view any node then my submit button should be enable how to do this . i am sending my button and javascript code
<asp:Button ID="btnSubmit" style="display:none" runat="server" Text="Send" CssClass="btn btn-primary"/>
<asp:TreeView ID="TreeView1" runat="server" ShowCheckBoxes="All" onclick="forClicked(this)" Checked="false"></asp:TreeView>
<script lang="javascript" type="text/javascript">
$(function () {
$("[id*=TreeView1] input[type=checkbox]").bind("click", function () {
var table = $(this).closest("table");
if (table.next().length > 0 && table.next()[0].tagName == "DIV") {
//Is Parent CheckBox
// var childDiv = table.next();
var isChecked = $(this).is(":checked");
$("input[type=checkbox]", childDiv).each(function () {
if (isChecked) {
$(this).attr("checked", "checked");
} else {
$(this).removeAttr("checked");
}
});
} else {
//Is Child CheckBox
// var parentDIV = $(this).closest("DIV");
if ($("input[type=checkbox]", parentDIV).length == $("input[type=checkbox]:checked", parentDIV).length) {
$("input[type=checkbox]", parentDIV.prev()).attr("checked", "checked");
} else {
$("input[type=checkbox]", parentDIV.prev()).removeAttr("checked");
}
}
});
})
</script>

Answers (1)

0
Photo of Jignesh Trivedi
NA 61.3k 14.2m 11y

hi,

As per me, this error occurs when you trying to access null object's properties / methods / public attribute or converting null object into other type of object.

here i think DataGridView1.CurrentRow.Cells["Column1"].Value has null value and your are trying to call is Tostring Method.

try...

data.slno = Convert.Tostring(DataGridView1.CurrentRow.Cells["Column1"].Value);

hope this will help you.


0
Photo of suhas setty
NA 99 35.5k 11y
i have library file there i intialised database add parameters
now from application file i hv to update database
0
Photo of Iftikar Hussain
NA 18.9k 275.5k 11y
Hi,
        
Before assigning the value to your class object, can you display the value like this

var temp=DataGridView1.CurrentRow.Cells["Column1"].Value;

MessageBox.Show(temp);
        
Regards,
Iftikar