TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sangeetha k
NA
207
51.6k
Correct Me where iam wrong?
Oct 4 2017 3:35 AM
I am trying to display message records unavailable if the particular record is not found with grid header but the problem is I have set the reset button so that it becomes empty but still after clicking the button also it shows the message in the empty data template!!!
Please help me with a solution
#Page design code
<
div
>
<
table
class
=
"table"
>
<
tr
>
<
td
>
<
asp:TextBox
runat
=
"server"
ID
=
"txtOrder_id"
Width
=
"180px"
>
asp:TextBox
>
td
>
<
td
>
<
asp:Button
runat
=
"server"
ID
=
"Btn"
Text
=
"Replacement request"
OnClick
=
"Btn_Click"
Style
=
"height: 26px"
/>
td
>
<
td
>
<
asp:Button
runat
=
"server"
ID
=
"btnstatus"
Text
=
"OrderRequest"
OnClick
=
"btnstatus_Click"
/>
td
>
<
td
>
<
asp:Button
CssClass
=
"btn"
ID
=
"btnreset"
runat
=
"server"
Text
=
"Reset"
OnClick
=
"btnreset_Click"
/>
td
>
tr
>
table
>
div
>
<
div
>
<
table
>
<
tr
>
<
td
>
<
asp:GridView
class
=
"grd2"
runat
=
"server"
ID
=
"grdReplacementRequest"
ShowHeaderWhenEmpty
=
"true"
AutoGenerateColumns
=
"False"
OnRowEditing
=
"grdReplacementRequest_RowEdit"
OnRowUpdating
=
"grdOrderReplacement_RowUpdating"
CellPadding
=
"4"
ForeColor
=
"#333333"
GridLines
=
"None"
>
<
AlternatingRowStyle
BackColor
=
"White"
ForeColor
=
"#284775"
/>
<
Columns
>
<
asp:TemplateField
HeaderText
=
"Customer_id"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblcustid"
runat
=
"server"
Text
=
'<%#Bind("Customer_id") %>'
>
asp:Label
>
ItemTemplate
>
<
FooterTemplate
>
<
asp:TextBox
ID
=
"txtcustid"
runat
=
"server"
>
asp:TextBox
>
FooterTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Product_id"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblpdid"
runat
=
"server"
Text
=
'<%#Bind("Product_id") %>'
>
asp:Label
>
ItemTemplate
>
<
FooterTemplate
>
<
asp:TextBox
ID
=
"txtproduct_id"
runat
=
"server"
>
asp:TextBox
>
FooterTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"choice"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblchoice"
runat
=
"server"
Text
=
'<%#Bind("choice") %>'
>
asp:Label
>
ItemTemplate
>
<
FooterTemplate
>
<
asp:TextBox
ID
=
"choice"
runat
=
"server"
>
asp:TextBox
>
FooterTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtChoice"
runat
=
"server"
Text
=
'<%#Bind("choice") %>'
>
asp:TextBox
>
EditItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Order_id"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblorderid"
runat
=
"server"
Text
=
'<%#Bind("order_id") %>'
>
asp:Label
>
ItemTemplate
>
<
FooterTemplate
>
<
asp:TextBox
ID
=
"txtorderid"
runat
=
"server"
>
asp:TextBox
>
FooterTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"TotalPurchaceValue"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblAmt"
runat
=
"server"
Text
=
'<%#Bind("totalamount") %>'
>
asp:Label
>
ItemTemplate
>
<
FooterTemplate
>
<
asp:TextBox
ID
=
"txtamt"
runat
=
"server"
>
asp:TextBox
>
FooterTemplate
>
asp:TemplateField
>
<
asp:TemplateField
>
<
EditItemTemplate
>
<
asp:Button
ID
=
"btnUpdates"
runat
=
"server"
Text
=
"Update"
CommandName
=
"Update"
/>
<
%--
<
asp:LinkButton
ID
=
"btnApprove"
runat
=
"server"
Text
=
"Approve"
CommandName
=
"Approved"
/>
<
asp:LinkButton
ID
=
"btnReject"
runat
=
"server"
Text
=
"Reject"
CommandName
=
"Rejected"
/>
--%
>
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Button
ID
=
"btnEdit"
runat
=
"server"
Text
=
"Edit"
CommandName
=
"Edit"
/>
ItemTemplate
>
asp:TemplateField
>
Columns
>
<
EmptyDataTemplate
>
No Records Available!!
EmptyDataTemplate
>
<
EditRowStyle
BackColor
=
"#999999"
/>
<
FooterStyle
BackColor
=
"#5D7B9D"
Font-Bold
=
"True"
ForeColor
=
"White"
/>
<
HeaderStyle
BackColor
=
"#5D7B9D"
Font-Bold
=
"True"
ForeColor
=
"White"
/>
<
PagerStyle
BackColor
=
"#284775"
ForeColor
=
"White"
HorizontalAlign
=
"Center"
/>
<
RowStyle
BackColor
=
"#F7F6F3"
ForeColor
=
"#333333"
/>
asp:GridView
>
td
>
tr
>
table
>
div
>
<
div
>
<
table
>
<
tr
>
<
td
>
<
asp:GridView
CssClass
=
"grd3"
runat
=
"server"
ID
=
"grdOrderDetails"
ShowHeaderWhenEmpty
=
"true"
AutoGenerateColumns
=
"False"
OnRowCancelingEdit
=
"grdOrderDetails_RowCancelingEdit"
OnRowEditing
=
"grdOrderDetails_RowEditing"
OnRowUpdating
=
"grdOrderDetails_Rowupdating"
ShowFooter
=
"True"
CellPadding
=
"4"
ForeColor
=
"#333333"
GridLines
=
"None"
>
<
AlternatingRowStyle
BackColor
=
"White"
ForeColor
=
"#284775"
/>
<
Columns
>
<
asp:TemplateField
HeaderText
=
"Customer_id"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Customer_id"
runat
=
"server"
Text
=
'<%#Bind("Customer_id") %>'
>
asp:Label
>
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtcustomerid"
runat
=
"server"
Text
=
'<%#Bind("Customer_id") %>'
>
asp:TextBox
>
EditItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Product_id"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Product_id"
runat
=
"server"
Text
=
'<%#Bind("Product_id") %>'
>
asp:Label
>
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtproductid"
runat
=
"server"
Text
=
'<%#Bind("Product_id") %>'
>
asp:TextBox
>
EditItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Category_id"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Category_id"
runat
=
"server"
Text
=
'<%#Bind("category_id") %>'
>
asp:Label
>
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtcategoryid"
runat
=
"server"
Text
=
'<%#Bind("category_id") %>'
>
asp:TextBox
>
EditItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Order_id"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Order_id"
runat
=
"server"
Text
=
'<%#Bind("order_id") %>'
>
asp:Label
>
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtorderid"
runat
=
"server"
Text
=
'<%#Bind("order_id") %>'
>
asp:TextBox
>
EditItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"TotalPurchaceValue"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Amount"
runat
=
"server"
Text
=
'<%#Bind("total") %>'
>
asp:Label
>
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtamt"
runat
=
"server"
Text
=
'<%#Bind("total") %>'
>
asp:TextBox
>
EditItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Quantity"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Quantity"
runat
=
"server"
Text
=
'<%#Bind("orderquantity") %>'
>
asp:Label
>
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"quantity"
runat
=
"server"
Text
=
'<%#Bind("orderquantity") %>'
>
asp:TextBox
>
EditItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Order_date"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblOrderdate"
runat
=
"server"
Text
=
'<%#Bind("Ordered_date") %>'
>
asp:Label
>
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtorderdate"
runat
=
"server"
Text
=
'<%#Bind("Ordered_date") %>'
>
asp:TextBox
>
EditItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
>
<
ItemTemplate
>
<
asp:Button
ID
=
"btn_Edit"
runat
=
"server"
Text
=
"Edit"
CommandName
=
"Edit"
/>
ItemTemplate
>
<
EditItemTemplate
>
<
asp:Button
ID
=
"btnUpdate"
runat
=
"server"
Text
=
"update"
CommandName
=
"Update"
/>
<
asp:Button
ID
=
"btnCancel"
runat
=
"server"
Text
=
"cancel"
CommandName
=
"Cancel"
/>
EditItemTemplate
>
<
FooterTemplate
>
<
asp:Button
ID
=
"btnAdd"
runat
=
"server"
Text
=
"add"
CommandName
=
"Add"
/>
FooterTemplate
>
asp:TemplateField
>
Columns
>
<
EmptyDataTemplate
>
No Records AVailable!!
EmptyDataTemplate
>
<
EditRowStyle
BackColor
=
"#999999"
/>
<
FooterStyle
BackColor
=
"#5D7B9D"
Font-Bold
=
"True"
ForeColor
=
"White"
/>
<
HeaderStyle
BackColor
=
"#5D7B9D"
Font-Bold
=
"True"
ForeColor
=
"White"
/>
<
PagerStyle
BackColor
=
"#284775"
ForeColor
=
"White"
HorizontalAlign
=
"Center"
/>
<
RowStyle
BackColor
=
"#F7F6F3"
ForeColor
=
"#333333"
/>
<
SelectedRowStyle
BackColor
=
"#E2DED6"
Font-Bold
=
"True"
ForeColor
=
"#333333"
/>
<
SortedAscendingCellStyle
BackColor
=
"#E9E7E2"
/>
<
SortedAscendingHeaderStyle
BackColor
=
"#506C8C"
/>
<
SortedDescendingCellStyle
BackColor
=
"#FFFDF8"
/>
<
SortedDescendingHeaderStyle
BackColor
=
"#6F8DAE"
/>
asp:GridView
>
td
>
tr
>
table
>
div
>
#code behind to display message with grid header
protected
void
Btn_Click(
object
sender, EventArgs e)
{
try
{
if
( grdReplacementRequest.Rows.Count > 0)
{
int
Order_id = Convert.ToInt32(txtOrder_id.Text);
bal.getOrderReturnrequest(Order_id);
grdOrderShow();
}
else
{
DataTable dt =
new
DataTable();
grdReplacementRequest.DataSource = dt;
grdReplacementRequest.DataBind();
}
}
catch
(Exception ex)
{
Console.WriteLine(
"error"
, ex.Message);
}
}
protected
void
btnstatus_Click(
object
sender, EventArgs e)
{
try
{
if
(grdOrderDetails.Rows.Count > 0)
{
showGrid2();
}
else
{
DataTable dt =
new
DataTable();
grdOrderDetails.DataSource = dt;
grdOrderDetails.DataBind();
}
}
catch
(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
protected
void
btnreset_Click(
object
sender, EventArgs e)
{
txtOrder_id.Text =
string
.Empty;
grdOrderDetails.DataSource =
null
;
grdOrderDetails.DataBind();
grdReplacementRequest.DataSource =
null
;
grdReplacementRequest.DataBind();
}
Reply
Answers (
1
)
How to get all properties of event viewer file(.evtx)?
using QR code retrieve data from database in mvc