Click here to Skip to main content
15,299,444 members

Comments by FabeCode (Top 37 by date)

FabeCode 12-Jul-13 16:30pm View
   
Correction the OnClick is on the ID="ResetButton" button. When pressed the error occurs.
FabeCode 12-Jul-13 16:27pm View
   
Here's the panel code:
<asp:Panel ID="pnlCustCharge" Width="275px" runat="server" Style="display: none">
<table style="margin-left: 75px">
<tr>
<td>
<asp:Button ID="OkButton" runat="server" Text="OK" Style="display: none"/>
<asp:Button ID="btnOk" runat="server" Text="OK"
OnClick="btnOk_Click"/>
</td>
<td style="width: 10px">
</td>
<td>
<asp:Button ID="CancelButton" runat="server" Text="Reset" />
<asp:Button ID="btnCancelRates" runat="server" Text="Cancel"
Style="display: none" OnClick="btnCancelRates_Click" />
</td>
<td style="width: 10px">
</td>
<td>
<asp:Button ID="ResetButton" runat="server" Text="Standard" />
<asp:Button ID="btnReset" runat="server" Text="Standard"
Style="display: none" OnClick="btnReset_Click" />
</td>
</tr>
</table>
FabeCode 12-Jul-13 16:21pm View
   
The javascript code is posted. There are only two functions defined. The ModalPopup has three buttons, but only two are refrenced in the extender:

<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnCustCharges"
PopupControlID="pnlCustCharge" BackgroundCssClass="modalBackground" DropShadow="true"
EnableViewState="true" OkControlID="OkButton" OnOkScript="onOk()" CancelControlID="CancelButton"
önCancelScript="onCancel()"/>

FabeCode 12-Jul-13 15:53pm View
   
Since I just need to reset the objects, I guess not (Not Sure, new to ASP). I need to replace text box values with those previously entered and stored in a datatable.
FabeCode 12-Jul-13 15:36pm View
   
<asp:Button ID="btnReset" runat="server" Text="Standard" OnClick="btnReset_Click"/>
FabeCode 12-Jul-13 15:30pm View
   
As a default, the ModalPopup has an two events, OnOkScript and OnCancelScript that call the relative javascript functions. I have added another button which I want to use to reset objects to a previously stored value. E.G. The user starts to make changes but then decides to use the "standard" values.

So, when I press the "Standard" button, the objects are set to the default values. However, when I press that button, I get the error: "Error: Unable to get property 'click' of undefined or null reference". So the newly added button's OnClick event is not accessible.
FabeCode 12-Jul-13 13:31pm View
   
I am clicking on a third button (btnReset) which I added. So there is a Ok, Cancel and Reset button. The first two have corresponding java function which is called via the ModalPopupExtender. How do I call the code behind for the third button?
FabeCode 12-Jul-13 13:02pm View
   
Where should I put a breakpoint?
FabeCode 12-Jul-13 12:10pm View
   
I only have javascript for the Ok and Cancel new button of the popup (none for the Reset):

<script type="text/javascript">
function onOk() {
document.getElementById('btnOk').click();
}

function onCancel() {
document.getElementById('btnCancelRates').click();

}
</script>

I would I call the onclick code for the new button?
FabeCode 3-Apr-13 1:57am View
   
I had to remove the < in order to copy/paste the code.
FabeCode 3-Apr-13 1:56am View
   
No. The panel does not appear when you click on the + in column 1
FabeCode 3-Apr-13 1:53am View
   
Deleted
No. This code does not working. The
FabeCode 3-Apr-13 1:32am View
   
For those lines that begin with ?, I remove the "less than" character. Hope this works...

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sample.aspx.cs" Inherits="Sample" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="~/Scripts/jquery-1.4.1.js" type="text/javascript">
$("[src*=plus]").live("click", function () {
$(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
$(this).attr("src", "~/resources/images/minus.png");
});
$("[src*=minus]").live("click", function () {
$(this).attr("src", "~/resources/images/plus.png");
$(this).closest("tr").next().remove();
});

</script>
</head>
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="true">
? cc1:ToolkitScriptManager>
<div>
<asp:Panel ID="AssgnOffcrs" runat="server">
<asp:Label ID="lblShifts" runat="server" Text="Number of Shifts:">
 
<asp:TextBox ID="txtNumShifts" runat="server" OnTextChanged="txtNumShifts_TextChanged"
Width="35px" AutoPostBack="True">
? asp:TextBox>
<asp:ImageButton ID="imgbAdd" runat="server" Visible="false"
ImageUrl="~/Resources/Images/add.png" onclick="imgbAdd_Click" />
<br />
<table id="tblShiftSumry">
<tr>
<td class="summaryCost">
<asp:GridView ID="gvShift" runat="server" AutoGenerateColumns="False" Height="95px"
Style="margin-right: 1px" Width="100px" OnRowDataBound="OnRowDataBound">
? Columns>
<asp:TemplateField HeaderText="Frequency">
? ItemTemplate>
<img alt="" style="cursor: pointer" src="Resources/Images/plus.png" />
<asp:Panel ID="pnlOrders" runat="server" Style="display: none">
<asp:Label ID="lblMsg" Width="100px" runat="server" Text="Testing 1...2...3">
? /asp:Panel>
? /ItemTemplate>
<HeaderStyle Width="15px" />
? /asp:TemplateField>
? /Columns>
? /asp:GridView>
</td>
</tr>
</table>
? /asp:Panel>
</div>
</form>
</body>
</html>
FabeCode 3-Apr-13 1:05am View
   
Something weird. No tags appear between the comments.
FabeCode 3-Apr-13 1:02am View
   
Deleted
For those tags that did not paste properly, you will have to remove the commented tags.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sample.aspx.cs" Inherits="Sample" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="~/Scripts/jquery-1.4.1.js" type="text/javascript">
$("[src*=plus]").live("click", function () {
$(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
$(this).attr("src", "~/resources/images/minus.png");
});
$("[src*=minus]").live("click", function () {
$(this).attr("src", "~/resources/images/plus.png");
$(this).closest("tr").next().remove();
});

</script>
</head>
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="true">
<%-- --%>
<div>
<asp:Panel ID="AssgnOffcrs" runat="server">
<asp:Label ID="lblShifts" runat="server" Text="Number of Shifts:">
 
<asp:TextBox ID="txtNumShifts" runat="server" OnTextChanged="txtNumShifts_TextChanged"
Width="35px" AutoPostBack="True">
<%-- --%>
<asp:ImageButton ID="imgbAdd" runat="server" Visible="false"
ImageUrl="~/Resources/Images/add.png" onclick="imgbAdd_Click" />
<br />
<table id="tblShiftSumry">
<tr>
<td class="summaryCost">
<asp:GridView ID="gvShift" runat="server" AutoGenerateColumns="False" Height="95px"
Style="margin-right: 1px" Width="100px" OnRowDataBound="OnRowDataBound">
<%-- <columns>--%>
<asp:TemplateField HeaderText="Frequency">
<%-- <itemtemplate>--%>
<img alt="" style="cursor: pointer" src="Resources/Images/plus.png" />
<asp:Panel ID="pnlOrders" runat="server" Style="display: none">
<asp:Label ID="lblMsg" Width="100px" runat="server" Text="Testing 1...2...3">
<%-- --%>
<%-- --%>
<HeaderStyle Width="15px" />
<%-- --%>

<%-- --%>
</td>
</tr>
</table>
<%-- --%>
</div>
</form>
</body>
</html>
FabeCode 3-Apr-13 0:52am View
   
All the end tags are removed when I paste.
FabeCode 3-Apr-13 0:50am View
   
For some reason that end tag gets erased when I paste the code.
FabeCode 3-Apr-13 0:48am View
   
Deleted
Sorry. I erred in cutting it down. I truly appreciate your efforts. Let's try again.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sample.aspx.cs" Inherits="Sample" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="~/Scripts/jquery-1.4.1.js" type="text/javascript">
$("[src*=plus]").live("click", function () {
$(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
$(this).attr("src", "~/resources/images/minus.png");
});
$("[src*=minus]").live("click", function () {
$(this).attr("src", "~/resources/images/plus.png");
$(this).closest("tr").next().remove();
});

</script>
</head>
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="true">

<div>
<asp:Panel ID="AssgnOffcrs" runat="server">
<asp:Label ID="lblShifts" runat="server" Text="Number of Shifts:">
 
<asp:TextBox ID="txtNumShifts" runat="server" OnTextChanged="txtNumShifts_TextChanged"
Width="35px" AutoPostBack="True">

<asp:ImageButton ID="imgbAdd" runat="server" Visible="false"
ImageUrl="~/Resources/Images/add.png" onclick="imgbAdd_Click" />
<br />
<table id="tblShiftSumry">
<tr>
<td class="summaryCost">
<asp:GridView ID="gvShift" runat="server" AutoGenerateColumns="False" Height="95px"
Style="margin-right: 1px" Width="100px" OnRowDataBound="OnRowDataBound">
<columns>
<asp:TemplateField HeaderText="Frequency">
<itemtemplate>
<img alt="" style="cursor: pointer" src="Resources/Images/plus.png" />
<asp:Panel ID="pnlOrders" runat="server" Style="display: none">
<asp:Label ID="lblMsg" Width="100px" runat="server" Text="Testing 1...2...3">


<HeaderStyle Width="15px" />



</td>
</tr>
</table>

</div>
</form>
</body>
</html>
FabeCode 2-Apr-13 15:39pm View
   
I could not fit the ASPX and ASPX.CS code file into the one reply. After deleting the combined reply and reducing the gridview columns, I posted each individually.
FabeCode 2-Apr-13 14:23pm View
   
Here's ASPX.CS code:
using System;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.Design;
using System.Web.Services;

public partial class Sample : System.Web.UI.Page
{
public int totrows = 0, CntShifts=0;

DataTable ShiftCnt
{
get
{
return (DataTable)ViewState["ShiftCnt"];
}
set
{
ViewState["ShiftCnt"] = value;
}
}


protected void Page_Load(object sender, EventArgs e)
{
}

private void ShiftSumry()
{
ShiftCnt = new DataTable();
ShiftCnt.Columns.Add("Shift #", typeof(string));
ShiftCnt.Columns.Add("Start", typeof(string));
ShiftCnt.Columns.Add("End", typeof(string));

for (int i = 1; i <= CntShifts; i++)
{
ShiftCnt.Rows.Add(i.ToString());

}
gvShift.DataSource = ShiftCnt;
gvShift.DataBind();
}

protected void txtNumShifts_TextChanged(object sender, EventArgs e)
{
CntShifts = Convert.ToInt16(txtNumShifts.Text);
ShiftSumry();
if (txtNumShifts.Text == "0") imgbAdd.Visible = false;
else imgbAdd.Visible = true;
}

protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Panel panel_find = ((Panel)e.Row.FindControl("pnlOrders"));
panel_find.Visible = true;
;
}
}

protected void imgbAdd_Click(object sender, ImageClickEventArgs e)
{
totrows = gvShift.Rows.Count + 1;
ShiftCnt.Rows.Add(totrows.ToString());
gvShift.DataSource = ShiftCnt;
gvShift.DataBind();
txtNumShifts.Text = totrows.ToString();
}
}
FabeCode 2-Apr-13 14:23pm View
   
Deleted
Here's ASPX Code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sample.aspx.cs" Inherits="Sample" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="~/Scripts/jquery-1.4.1.js" type="text/javascript">
$("[src*=plus]").live("click", function () {
$(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
$(this).attr("src", "~/resources/images/minus.png");
});
$("[src*=minus]").live("click", function () {
$(this).attr("src", "~/resources/images/plus.png");
$(this).closest("tr").next().remove();
});

</script>
</head>
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="true">

<div>
<asp:Panel ID="AssgnOffcrs" runat="server">
<asp:Label ID="lblShifts" runat="server" Text="Number of Shifts:">
 
<asp:TextBox ID="txtNumShifts" runat="server" OnTextChanged="txtNumShifts_TextChanged"
Width="35px" AutoPostBack="True">

<asp:ImageButton ID="imgbAdd" runat="server" Visible="false"
ImageUrl="~/Resources/Images/add.png" onclick="imgbAdd_Click" />
<br />
<table id="tblShiftSumry">
<tr>
<td class="summaryCost">
<asp:GridView ID="gvShift" runat="server" AutoGenerateColumns="False" Height="95px"
Style="margin-right: 1px" Width="100px" OnRowDataBound="OnRowDataBound">
<columns>
<asp:TemplateField HeaderText="Frequency">
<itemtemplate>
<img alt="" style="cursor: pointer" src="Resources/Images/plus.png" />
<asp:Panel ID="pnlOrders" runat="server" Style="display: none">
<asp:Label ID="lblMsg" Width="100px" runat="server" Text="Testing 1...2...3">


<HeaderStyle Width="15px" />



</td>
</tr>
</table>

</div>
</form>
</body>
</html>
FabeCode 2-Apr-13 14:02pm View
   
Deleted
The objective is to have a panel appear when the user clicks on the "+" in the first column.

Here's the ASPX code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sample.aspx.cs" Inherits="Sample" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="~/Scripts/jquery-1.4.1.js" type="text/javascript">
$("[src*=plus]").live("click", function () {
$(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
$(this).attr("src", "~/resources/images/minus.png");
});
$("[src*=minus]").live("click", function () {
$(this).attr("src", "~/resources/images/plus.png");
$(this).closest("tr").next().remove();
});

</script>
</head>
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="true">

<div>
<asp:Panel ID="AssgnOffcrs" runat="server">
<asp:Label ID="lblShifts" runat="server" Text="Number of Shifts:">
 
<asp:TextBox ID="txtNumShifts" runat="server" OnTextChanged="txtNumShifts_TextChanged"
Width="35px" AutoPostBack="True">

<asp:ImageButton ID="imgbAdd" runat="server" Visible="false"
ImageUrl="~/Resources/Images/add.png" onclick="imgbAdd_Click" />
<br />
<table id="tblShiftSumry">
<tr>
<td class="summaryCost">
<asp:GridView ID="gvShift" runat="server" AutoGenerateColumns="False" Height="95px"
Style="margin-right: 1px" Width="500px" OnRowDataBound="OnRowDataBound">
<columns>
<asp:TemplateField HeaderText="Frequency">
<itemtemplate>
<img alt="" style="cursor: pointer" src="Resources/Images/plus.png" />
<asp:Panel ID="pnlOrders" runat="server" Style="display: none">
<asp:Label ID="lblMsg" Width="100px" runat="server" Text="Testing 1...2...3">


<HeaderStyle Width="15px" />

<asp:TemplateField HeaderText="Start Time">
<itemtemplate>
<asp:TextBox ID="txtStartTime" runat="server" ValidationGroup="MKE"
Text='<%# DataBinder.Eval(Container.DataItem, "Start") %>'
Width="65px" AutoPostBack="True">
<cc1:MaskedEditExtender ID="MaskedEditExtender3" runat="server" AcceptAMPM="True"
CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" CultureDateFormat=""
CultureDatePlaceholder="" CultureDecimalPlaceholder="" CultureThousandsPlaceholder=""
CultureTimePlaceholder="" Enabled="True" ErrorTooltipEnabled="True" Mask="99:99"
MaskType="Time" TargetControlID="txtStartTime">

FabeCode 2-Apr-13 12:29pm View
   
New to JQuery. Can you provide an example?
FabeCode 2-Apr-13 10:54am View
   
No. it has not. The panel does not show once I click on the "plus" in first column of the grid.
FabeCode 1-Apr-13 9:53am View
   
This is a nesting issue. I need to have the panel appear/hide when the user clicks on the plus/minus in the first column. I tried to use the script code in conjunction with the OnRowDataBound method to accomplish this task. Thanks.
FabeCode 1-Apr-13 9:48am View
   
Thanks for the "panel_find" code. That eliminated the error.

But how do I get the panel to appear/hide upon clicking on the plus/minus in the first column. I tried to accomplish that with the javascript.
FabeCode 1-Apr-13 2:33am View
   
In the code behind, i get an error: pnlOrders does not exist. Do you have simple code example that works?
FabeCode 1-Apr-13 0:02am View
   
How do I nest a panel that will contain a table, radio button, text box and check box?
FabeCode 28-Mar-13 16:15pm View
   
I don't know how to answer that. Do I use Server.Transfer or Response.Redirect?
FabeCode 28-Mar-13 16:12pm View
   
From where can I get an example?
FabeCode 28-Mar-13 16:12pm View
   
From where can I get an example?
FabeCode 29-Jan-13 12:57pm View
   
Sorry you are correct.
FabeCode 29-Jan-13 12:48pm View
   
Percent (%) keeps it relative to the total column width. So if the total column width changes, the object's size will automatically. You won't have to manually change it.
FabeCode 29-Jan-13 12:13pm View
   
I placed "DataRowView drv = gvEquipment.CurrentCell.Item as DataRowView;" in the "protected void txtEquipCnt_TextChanged(object sender, EventArgs e)" method.

I get the following error:

'System.Web.UI.WebControls.GridView' does not contain a definition for 'CurrentCell' and no extension method 'CurrentCell' accepting a first argument of type 'System.Web.UI.WebControls.GridView' could be found (are you missing a using directive or an assembly reference?)
FabeCode 29-Jan-13 12:03pm View
   
It formats the size of the element within the column.
FabeCode 2-Nov-12 0:58am View
   
I have tried but with no success. How/Where do I save the values? Doesn't the following statement save the values in ViewState:
ViewState["CurrentTable"] = dt;


And, how/where do I restore them? In the PageLoad, right? So, I should use the following in that event:
gvGenrateRow.DataSource = ViewState["CurrentTable"];
gvGenrateRow.DataBind();

Thanks.
FabeCode 1-Nov-12 11:06am View
   
I am able to create the grid, however, it is reset on AutoPostBack. How do I retain the values?