My Onclick Element in my LinkButton not triggered because of the modal(?) - c#

so i use the same modal to create new and edit existing Studio Detail. when i want to edit existing, i click on the studio name on the table, get the data from DB, and insert it to textbox and change the button inside the modal as "Update" to update the record. but when i want to create new, it set the textbox inside the modal to empty, and change the button text to Save, but when i pun debug point at the OnClick function, it didn't triggered.
Modal:
<asp:UpdatePanel runat="server" ID="upDetailModal" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-7">
</div>
<div class="col-5">
<asp:LinkButton runat="server" ID="lbAddDetail" Text="Add Detail" CssClass="btn userButton" OnClick="lbAddDetail_Click" CausesValidation="false" data-bs-toggle="modal" data-bs-target="#detailModal"/>
</div>
</div>
</div>
<div id="modalDetail">
<div class="modal fade" id="detailModal" tabindex="-1" aria-labelledby="Studio Background" aria-hidden="true" >
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="detailTitle">Studio Background</h4>
</div>
<div class="modal-body">
<p>Studio Background Name</p>
<asp:TextBox runat="server" ID="txtStudioBackgroundName" CssClass="loginForm" />
<br />
<br />
<p>Studio Background Capacity</p>
<asp:TextBox runat="server" ID="txtStudioBackgroundCapacity" CssClass="loginForm" />
<br />
<br />
<p>Studio Package</p>
<asp:FileUpload runat="server" ID="fuStudioBackground" AllowMultiple="true" accept="image/png,image/jpeg" CssClass="loginForm" />
</div>
<div class="modal-footer">
<asp:LinkButton runat="server" ID="lbSaveDetail" CssClass="btn userButton" Text="Save" OnClick="lbSaveDetail_Click" />
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
protected void lbAddDetail_Click(object sender, EventArgs e)
{
idDetail = 0;
txtStudioBackgroundCapacity.Text = "";
txtStudioBackgroundName.Text = "";
lbSaveDetail.Text = "Save";
upDetailModal.Update();
showDetailModal();
}
I think the modal and the onClick function is clashed. i expect the onClick function to be triggered when i click the button

Related

How can I select the record in the grid view and delete or edit this record? In Asp.Net Web Form

How can I select the record in the grid view and delete or edit this record? In Asp.Net Web Form
I want this to be done with the Bootstrap modal
I do this with Entity Framework
I have only been able to code to add
The methods I know for editing and deleting are not suitable for this project and they do not work on Bootstrap Modal
Html Code:
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ProductControl.aspx.cs" Inherits="AppData.Pages.ProductControl" %>
<asp:Content ID="HeadContent" ContentPlaceHolderID="Head" runat="server">
<script src="../Scripts/jquery-3.6.0.slim.min.js"></script>
<script src="../Scripts/Site.js"></script>
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<div class="container">
<div class="row">
<div class="col-md-12 table-responsive" id="ProductDiv">
<div class="d-flex justify-content-between align-items-center mb-3 mt-3">
<h4>List of Products</h4>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<ContentTemplate>
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#ModalAdd">
Add Product
</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:GridView ID="GridView" runat="server" CssClass="table text-center table-bordered table-hover" HeaderStyle-CssClass="table-dark" AutoGenerateColumns="false" DataKeyNames="Id" OnRowCommand="GridView_RowCommand">
<Columns>
<asp:TemplateField HeaderText="" ItemStyle-Font-Size="Small">
<HeaderTemplate>Row</HeaderTemplate>
<ItemTemplate><%# Container.DataItemIndex+1 %></ItemTemplate>
<ItemStyle Wrap="False" />
</asp:TemplateField>
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Price" HeaderText="Price" />
<asp:BoundField DataField="Type" HeaderText="Type" />
<asp:BoundField DataField="Barcode" HeaderText="Barcode" />
<asp:TemplateField HeaderText="Commands" ItemStyle-Font-Size="Small">
<ItemTemplate>
<asp:LinkButton CssClass="btn btn-warning" ID="BtnEdit" runat="server">Edit</asp:LinkButton>
<asp:LinkButton CssClass="btn btn-danger" ID="BtnDelete" runat="server" data-toggle="modal" data-target="#ModalDelete">Delete</asp:LinkButton>
<asp:LinkButton CssClass="btn btn-info" ID="BtnDetail" runat="server">Detail</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<div class="row">
<asp:Label ID="LblNotFound" runat="server" Text="No Product Found" CssClass="col-12 alert alert-danger text-center" Visible="false"></asp:Label>
</div>
</div>
<!-- Modal Add -->
<asp:UpdatePanel ID="UpdatePanelModalAdd" runat="server">
<ContentTemplate>
<div class="modal" id="ModalAdd">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Add New Record</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-6">
<p>Name:</p>
<asp:TextBox ID="Name" placeholder="Name" runat="server" CssClass="form-control"></asp:TextBox>
</div>
<div class="col-6">
<p>Price:</p>
<asp:TextBox ID="Price" placeholder="Price" runat="server" CssClass="form-control"></asp:TextBox>
</div>
</div>
<div class="row">
<div class="col-6">
<br />
<p>Type:</p>
<asp:TextBox ID="Type" placeholder="Type" runat="server" CssClass="form-control"></asp:TextBox>
</div>
<div class="col-6">
<br />
<p>Barcode:</p>
<asp:TextBox ID="Barcode" placeholder="Barcode" runat="server" CssClass="form-control"></asp:TextBox>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnCreate" runat="server" CssClass="btn btn-success" Text="Create" OnClick="BtnCreate_Click" />
<asp:Button ID="BtnCancel" runat="server" CssClass="btn btn-danger" Text="Cancel" data-dismiss="modal" />
</div>
</div>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="BtnCreate" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="BtnCancel" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<!-- Modal Detail -->
<asp:UpdatePanel ID="UpdatePanelModalDetail" runat="server">
<ContentTemplate>
<div class="modal" id="ModalDetail">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Detail Record</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-6">
<p>Name:</p>
<asp:Label ID="LblName" CssClass="text-secondary" runat="server" Text=""></asp:Label>
</div>
<div class="col-6">
<p>Price:</p>
<asp:Label ID="LblPrice" CssClass="text-secondary" runat="server" Text=""></asp:Label>
</div>
</div>
<div class="row">
<div class="col-6">
<br />
<p>Type:</p>
<asp:Label ID="LblType" CssClass="text-secondary" runat="server" Text=""></asp:Label>
</div>
<div class="col-6">
<br />
<p>Barcode:</p>
<asp:Label ID="LblBarcode" CssClass="text-secondary" runat="server" Text=""></asp:Label>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="Button1" runat="server" CssClass="btn btn-success" Text="Create" OnClick="BtnCreate_Click" />
<asp:Button ID="Button2" runat="server" CssClass="btn btn-danger" Text="Cancel" data-dismiss="modal" />
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<!-- Modal Delete -->
<asp:UpdatePanel ID="UpdatePanelModalDelete" runat="server">
<ContentTemplate>
<div class="modal" id="ModalDelete">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Delete Record</h4>
</div>
<div class="modal-body">
<h6 class="text-center">Are you sure you want to delete this record?</h6>
<br />
<div class="text-center">
<asp:Button ID="Delete" CssClass="btn btn-danger border-2 border-dark" runat="server" Text="Delete" CommandArgument='<%# Eval("Id") %>' CommandName="Delete" />
<button id="Cancel" class="btn btn-light border-2 border-dark" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Delete" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
</asp:Content>
And Backend Code:
using AppData.Models;
using System;
using System.Collections.Generic;
using System.EnterpriseServices;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace AppData.Pages
{
public partial class ProductControl : System.Web.UI.Page
{
Models.ProductDbEntities Db = new Models.ProductDbEntities();
protected void Page_Load(object sender, EventArgs e)
{
if (GridView.Rows.Count > 0)
{
LblNotFound.Visible = false;
}
else
{
GridView.DataSource = Db.TblProducts.ToList();
GridView.DataBind();
}
}
protected void BtnCreate_Click(object sender, EventArgs e)
{
TblProduct Row = new TblProduct();
Row.Name = Name.Text;
Row.Price = Price.Text;
Row.Type = Type.Text;
Row.Barcode = Convert.ToInt64(Barcode.Text);
Db.TblProducts.Add(Row);
Db.SaveChanges();
Response.Redirect("ProductControl.aspx");
}
protected void BtnCancel_Click(object sender, EventArgs e)
{
Response.Redirect("Pages/ProductControl.aspx");
}
protected void GridView_RowCommand(object sender, GridViewCommandEventArgs e)
{
var id = e.CommandArgument;
if (e.CommandName == "Delete")
{
Int64 Id = Convert.ToInt64(id);
var Row = Db.TblProducts.FirstOrDefault(n => n.Id == Id);
Db.TblProducts.Remove(Row);
Db.SaveChanges();
Response.Redirect("DataControl.aspx");
GridView.DataSource = Db.TblProducts.ToList();
GridView.DataBind();
}
}
}
}
I understand your approach, but if you are using bootstrap modals you need to write a little bit more code.
One way to achieve this is by following the next steps:
In the Delete modal add a hidden field to hold the selected productId and an event handler for the delete button:
<div class="modal-body">
<h6 class="text-center">Are you sure you want to delete this record?</h6>
<br />
<!--add this inside delete modal -->
<input type="hidden" id="productIdToDelete" runat="server" />
<div class="text-center">
<!-- remove CommandArgument and CommandName from the Delete button. They are useless in the popup. -->
<!-- add an event handler to OnClick-->
<asp:Button ID="Delete" CssClass="btn btn-danger border-2 border-dark" runat="server" Text="Delete" OnClick="BtnDelete_Click" />
...
Create event handlers for when the modal is opened in order to propagate the productId from the current row in the grid to the modal:
<script src="../Scripts/Site.js"></script>
<script type="text/javascript">
$(document).ready(
function () {
//use a jquery selector to assign an event handler to all Delete Buttons found on the page (nottice they all start with the same prexif)
$("[id*=MainContent_GridView_BtnDelete]").click(function () {
//get the id of the product from the selected row first cell and assign it to the hidden field in the modal
$("#MainContent_productIdToDelete").val($(this).closest('tr').find('td').eq(0).html());
});
});
</script>
Finally, handle the delete event in the code behind:
protected void BtnDelete_Click(object sender, EventArgs e)
{
string idVal = Request.Form[productIdToDelete.UniqueID];
var id = Convert.ToInt64(idVal);
// implement delete logic ...
}
Use the same approach for Edit. (Look at this example.)

The second Modal in my ASPX file doesn't Post when clicking submit button

I have an ASPX file that contains two modals (myModal and addModal) and a gridview that has buttons calling each of these. I am having trouble with the second modal when opening and clicking its Submit button as it won't fire a PostBack. Its only a problem with the second one. If I change the sequence of these Modals within the ASPX file, then I again have trouble only with the second one in the file.
Is there something additional needed when having two modals in the same ASPX page to get it to fire a PostBack?
Here are the ASPX and C# files:
C# file:
protected void Page_Load(object sender, EventArgs e)
{
try{
if (IsPostBack)
{
Control control = null;
string controlName = Request.Params["__EVENTTARGET"];
if (!String.IsNullOrEmpty(controlName))
{
control = FindControl(controlName);
GridViewRow gvRow1 = (GridViewRow)control.Parent.Parent;
string controlID = control.ID.ToString();
}
}
if(!IsPostBack)
{
DataGrid_Load(DAL.reg(HeadText.Text, OrgText.Text), "reg");
ErrorText.Text = "NO POSTBACK";
}
}
catch{}
}
ASPX file:
<div id="myModal" class="modal fade">
<script type="text/javascript">
function openModal() {
$('[id*=myModal]').modal('show');
}
</script>
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title">Update Data</h2>
</div>
<div class="modal-body">
<form class="form-inline" role="form" method="POST" action="" >
<div class="control-group">
<div class="controls controls-row">
<label for="lblnameid" class="col-sm-2 control-label">Name</label>
<div class="col-sm-6">
<asp:TextBox ID="lblnameid" runat="server" Text="" CssClass="form-control" ></asp:TextBox>
</div>
<label for="rankid" class="col-sm-1 control-label">Rank</label>
<div class="col-sm-3">
<asp:DropDownList id="rankid" runat="server" CssClass="form-control"
SelectedValue='<%# Eval("rank") %>' TabIndex='<%# TabIndex %>'>
<asp:ListItem Value=""> </asp:ListItem>
<asp:ListItem Value="a"> A </asp:ListItem>
<asp:ListItem Value="b"> B </asp:ListItem>
<asp:ListItem Value="c"> C </asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div>
<p> </p>
<div class="control-group">
<div class="col-sm-10">
<asp:TextBox ID="id" type="hidden" runat="server" Text="" CssClass="form-control" ></asp:TextBox>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="pull-right">
<button type="submit" class="btn btn-default">Cancel</button>
<!-- <button type="submit" class="btn btn-primary">Save</button> -->
<asp:Button ID="btnUpdate" OnClientClick="<% %>" class="btn btn-default" runat="server" Text="Save" CommandArgument='<%# Eval("Id") %>' OnCommand="btnUpdate_Click" />
</div>
</div>
</div>
</form>
</div><!-- /.modal-body -->
<form role="form" action="">
<div class="modal-footer">
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="addModal" class="modal fade" tabindex="-1" method="POST" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<script type="text/javascript">
$('#addModal').on('hidden.bs.modal', function () {
$(this).find('form').trigger('reset');
})
</script>
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<form class="form-horizontal" role="form">
<fieldset>
<div class="form-group">
<label class="col-sm-2 control-label" for="textinput">Name</label>
<div class="col-sm-6">
<input type="text" id="lblnameid" class="form-control">
</div>
</div>
</fieldset>
<div class="modal-footer">
<asp:Button ID="btnSubmit" OnClientClick="<% %>" class="btn btn-primary" runat="server" Text="Save" CommandArgument='<%# Eval("Id") %>' OnCommand="btnSubmit_Click" />
</div>
</form>
</div>
</div>
</div> <!-- /.modal-body -->
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
The problem was I had 3 sets of form tags in my page. One for the overall page and one each for the two Bootstrap Modals I had that opened up from button clicks. The solution came when I removed the form tags from the bootstrap modals. Then all button clicks from the modals worked properly and submitted the data.

Accessing bootstrap Modal Controls from CodeBehind c# web forms

I am using bootstrap data-id to populate the controls in modal bootstrap.
After this action, once user makes changes to the input values, on button click I want to access those values in c# Code behind and submit those values to database.
http://www.aspsnippets.com/demos/267/
The link show to use hidden field,
Here is my code so far
<asp:HiddenField ID="hdnField" runat="server" Value="" />
<a href="#" data-target="#my_modal" data-toggle="modal" class="myModalDialog"
data-id="First Name" data-name="My Name">Open Modal</a>
<div class="modal fade hmodal-info" id="my_modal" tabindex="4000" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="color-line">
</div>
<div class="modal-header text-center">
<h4 class="modal-title">
Edit Details</h4>
<small class="font-bold"> Name Goes here.</small>
</div>
<div class="modal-body">
<p>
some content</p>
<input type="text" name="bookId" id="bookId" value="" />
<input type="text" name="bookName" id="bookName" value="" />
<asp:TextBox ID="txtVendorId" runat="server"></asp:TextBox>
</div>
<div class="modal-footer">
<asp:Button ID="btnCallServer" runat="server" Text="Submit" />
<asp:Label ID="Label1" runat="server" Text="Click here to submit" class="btn btn-success" ></asp:Label>
<asp:HiddenField ID="HiddenField1" runat="server" Value="" />
</div>
</div>
</div>
</div>
$(document).ready(function () {
$(document).on("click", ".myModalDialog", function () {
var myBookId = $(this).data('id');
alert($(this).data('name'));
$(".modal-body #bookId").val(myBookId);
var myBookName = $(this).data('name');
$(".modal-body #bookName").val(myBookName);
$('[id$=txtVendorId]').val(myBookName);
});//href click
$('#<% =Label1.ClientID %>').click(function (e) {
var txt = "";
txt = $('#<% =txtVendorId.ClientID %>').val();
$("#<%=btnSubmit.ClientID%>").click();
});
});//documnet ready
<div class="modal fade hmodal-info" id="my_modal" tabindex="4000" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="color-line">
</div>
<div class="modal-header text-center">
<h4 class="modal-title">
Edit Details</h4>
<small class="font-bold"> Name Goes here.</small>
</div>
<div class="modal-body">
<p>
some content</p>
<input type="text" name="bookId" id="bookId" value="" />
<input type="text" name="bookName" id="bookName" value="" />
<asp:TextBox ID="txtVendorId" runat="server"></asp:TextBox>
</div>
<div class="modal-footer">
<asp:Button ID="btnCallServer" runat="server" Text="Submit" />
<asp:Label ID="Label1" runat="server" Text="Click here to submit" class="btn btn-success" ></asp:Label>
<asp:HiddenField ID="HiddenField1" runat="server" Value="" />
</div>
</div>
</div>
</div>

not to validate a page on onclick

I'm using bootstrap in my application.
I'm validation a page on a Click of Save button.But validation applies for all available buttons in the page.Here is my code:
Default.aspx
<div class="row-fluid">
<div class="form-horizontal">
<div class="col-sm-6">
<div class="form-group">
<label for="txtName" class="col-sm-4 control-label no-padding-right">
Asset Name</label>
<div class="col-sm-8">
<asp:TextBox ID="txtName" runat="server" ToolTip="Name" TextMode="MultiLine"
Width="300px" Style="resize: none;" data-val-required=" Name is required."
data-val="true"> </asp:TextBox>
<span class="field-validation-valid text-warning red" data-valmsg-for="txtName"
data-valmsg-replace="true"></span>
</div>
</div>
<div class="form-group">
<label for="txtLocation" class="col-sm-4 control-label no-padding-right">
Location</label>
<div class="col-sm-8">
<asp:TextBox ID="txtLocation" runat="server" ToolTip="Location" data-val-required=" Location is required."
Width="300px" data-val="true"> </asp:TextBox>
<span class="field-validation-valid text-warning red" data-valmsg-for="txtLocation"
data-valmsg-replace="true"></span>
</div>
</div>
</div>
</div>
<div class="pull-right">
<button id="btnSave" title="Save" class="btn btn-sm btn-primary"
onclick="Save();" runat="server">
Save
</button>
<button id="btnCancel" title="Save & Next" class="btn btn-sm btn-primary"
onclick="Cancel();" runat="server">
Cancel
</button>
</div>
</div>
<asp:Button ID="btnCancelPage" runat="server" OnClick="btnCancelPage_Click"
Style="display: none" />
<script language="javascript" type="text/javascript">
function Cancel(){
$("#btnCancelPage").Click();
}
$(document).ready(function () {
$('#btnSave,#btnCancel').click(function (e) {
e.preventDefault();
});
});
</script>
Default.aspx.cs
protected void btnCancelPage_Click(object sender, EventArgs e)
{
Context.Items.Add("ID", "10");
string targetPath ="~/SamplePage.aspx";
Server.Transfer(targetPath);
}
when i click on the cancel button, Page validation is occurring.
I dont want to validate the page while Cancel button is clicked.
Please help me out.
Use linkbutton to ignore your validation
<asp:LinkButton CssClass="btn btn-info" runat="server" ID="btnCancel" Text="Cancel" PostBackUrl="~/default.aspx"></asp:LinkButton>
you may also add an OnClick() event in linkbutton.. i just used the PostBackUrl as a sample on redirecting to other page.
I hope this will help you

Add Form in a Modal

I making an add form in my modal. The modal contains 2 dropdownlists, 4 textboxes (1 hidden) and a button for adding.
I bind my dropdown list for the item category then bind my other dropdown list for the item name. However when I change my Item Category in my dropdown list the dropdown list for my item name is not responding or it not binding. Can anyone help me?
<div id="addModal" class="modal fade">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Add Item</h4>
</div>
<div class="modal-body">
<div class="form-inline form-group">
<asp:Label ID="Label1" CssClass="control-label col-xs-3" runat="server" Text="Category:"></asp:Label>
<div class="col-xs-offset-3">
<asp:DropDownList ID="drpCategory" runat="server" CssClass="form-control col-xs-5" OnTextChanged="drpCategory_TextChanged" />
</div>
</div>
<div class="form-inline form-group">
<asp:Label ID="Label2" CssClass="control-label col-xs-3" runat="server" Text="Item Name:"></asp:Label>
<div class="col-xs-offset-3">
<asp:TextBox ID="txtitem" runat="server" CssClass="form-control col-xs-5" Visible="false" />
<asp:DropDownList ID="drpItem" runat="server" CssClass="form-control col-xs-5" Visible="true" />
</div>
</div>
<div class="form-inline form-group">
<asp:Label ID="Label3" CssClass="control-label col-xs-3" runat="server" Text="Unit:"></asp:Label>
<div class="col-xs-offset-3">
<asp:TextBox ID="txtUnit" runat="server" CssClass="form-control col-xs-5" Enabled="false" />
</div>
</div>
<div class="form-inline form-group">
<asp:Label ID="Label4" CssClass="control-label col-xs-3" runat="server" Text="Quantity:"></asp:Label>
<div class="col-xs-offset-3">
<asp:TextBox ID="txtQty" runat="server" CssClass="form-control col-xs-3" type="number" min="1" onkeypress="return isNumberKey(event)" />
</div>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button runat="server" ID="btnADD" CssClass="btn btn-sm" OnClick="btnADD_Click" Text="Add" />
</div>
</div>
</div>
then this is the code behind:
public void drpCategory_TextChanged(object sender, EventArgs e)
{
if (drpCategory.Text == "Others")
{
drpItem.Visible = false;
txtitem.Visible = true;
}
else
{
byCateg();
DataBind();
drpItem.Visible = true;
txtitem.Visible = false;
}
}
Is there a problem in my code?

Categories

Resources