Sunday, March 11, 2012

debugging advice needed to track events and event bubbling

Hi,

Your problem is a faq regarding dynamic controls. Please refer to thisthreadwith similar problem.


raymond thanks for your reply - its much appreciated
but i had already read that article and tried following the sequence of events as outlined
i tried again upon your suggestion and still am not getting the eventhandler 'hit' to trigger

im obviously missing something

which is why i wanted to figure a way how to track the event instead of line items
if there is no way then can i ask you to take a look at my code?
my issue is is that it never hits the dynamically created eventhandler for the 'hit' routine
thanks - any thoughts would be appreciated

<p>
<asp:UpdatePanel ID="gridviewUP" runat="server" ChildrenAsTriggers="true" UpdateMode="conditional">
<ContentTemplate>
<asp:GridView ID="GV" runat="server" AutoGenerateColumns="False" CssClass="buglog"
DataSourceID="buglogODS" DataKeyNames="bugID"
OnRowDataBound="GV_RDB"
EnableViewState="False"
>
<Columns>
<asp:BoundField DataField="bugID" HeaderText="Bug" />

<asp:TemplateField HeaderText="Priority">
<ItemTemplate>
<asp:LinkButton ID="pLink" runat="server" Text='<%# Eval("priority") %>'
OnCommand="makePopupShort"
CommandName="priority">
</asp:LinkButton>

<asp:Panel ID="pPanel" runat="server" CssClass="popupMenu" >
</asp:Panel>

<ajaxToolkit:PopupControlExtender ID="pce" runat="server"
TargetControlID="pLink" PopupControlID="pPanel">
</ajaxToolkit:PopupControlExtender>
</ItemTemplate>
</asp:TemplateField
</Columns>
</asp:GridView>
</ContentTemplate></asp:UpdatePanel>
</p
<p></p>
<!-- dont ever take this out on this page -->
<asp:UpdatePanel ID="debuggerUP" runat="server" ChildrenAsTriggers="true" UpdateMode="conditional">
<ContentTemplate>
Debugger: <asp:Label ID="debugger" runat="server" Text="Label"></asp:Label><br />
<asp:Button ID="debug" runat="server" Text="debug" OnClick="hitme_Click" CausesValidation="false" />
<asp:Button ID="clear" runat="server" Text="clear" OnClick="clear_Click" CausesValidation="false" />
</ContentTemplate>
</asp:UpdatePanel>
<p></p>

protected void Page_Load(object sender, EventArgs e)
{

// setup page
createMasterLinks();

// postback specific stuff
if (Page.IsPostBack)
{
string viewpop = (string)ViewState["popup"];
if (viewpop != null)
{
int length = viewpop.Length;
string type = viewpop.Substring(0, 1);
int rowID = Convert.ToInt32(viewpop.Substring(1));
debugger.Text += "in pb@." + rowID;

switch (type)
{
case "p":
GridViewRow row = (GridViewRow)GV.Rows[rowID];
Panel pPanel = (Panel)row.FindControl("pPanel");

foreach (LinkButton l in pArray)
{
LinkButton newl = new LinkButton();

newl.ID = l.ID;
newl.Text = l.Text;
newl.Command += new CommandEventHandler(hit);
newl.CommandName = l.CommandName;
newl.CommandArgument = l.CommandArgument;
pPanel.Controls.Add(newl);

ViewState.Add("popup", "p" + rowID);
debugger.Text += "built pb@." + rowID;
}
break;
default:
break;
}

}
DataBind();
}
else
{
debugger.Text = "";
}
}

/* build popup panels */
protected void makePopupShort(object sender, CommandEventArgs e)
{
string command = e.CommandName;
int rowID = Convert.ToInt32(e.CommandArgument);
int bugID = (int)GV.DataKeys[rowID].Value;
GridViewRow row = (GridViewRow)GV.Rows[rowID];
debugger.Text += "short in@." + rowID;

switch (command)
{
case "priority":

PopupControlExtender pce = (PopupControlExtender)row.FindControl("pce");
Panel pPanel = (Panel)row.FindControl("pPanel");

foreach (LinkButton l in pArray)
{
LinkButton newl = new LinkButton();

newl.ID = l.ID;
newl.Text = l.Text;
newl.Command += new CommandEventHandler(hit);
newl.CommandName = l.CommandName;
newl.CommandArgument = l.CommandArgument;
pPanel.Controls.Add(newl);

ViewState.Add("popup", "p"+rowID);
debugger.Text += "building" + ViewState["popup"];
}

pce.OffsetX = 7;
pce.OffsetY = 7;

break;
default:
debugger.Text += "no popup";
break;
}

debuggerUP.Update();
}

protected void GV_RDB(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
GridViewRow row = (GridViewRow)e.Row;
int rowID = row.RowIndex;
int bugID = Convert.ToInt32(GV.DataKeys[rowID].Value);
LinkButton theLink = (LinkButton)row.FindControl("pLink");
theLink.CommandArgument = rowID.ToString();
}
}

protected void hit(object sender, CommandEventArgs e)
{
debugger.Text = "hit";
debuggerUP.Update();
}


Hi,

Where is the definition of pArray?

Would you mind posting a workable sample?


hey raymond
pArray is just a pre-initialised array of strings {p1,p2,p3,p4,p5}
which is initialised in createMasterLinks
(and thats all that createMasterLinks does)

i dont know what you mean by workable sample
the code doesnt work which is why im posting here

i really apprecitae your help
toy

posting code below
i can also send you files if you prefer:

<asp:Content runat="server" ContentPlaceHolderID="maincontent" ID="main" Visible="true">
<script language="javascript" type="text/javascript">
function closeWindow()
{
AjaxControlToolkit.PopupControlBehavior.__VisiblePopup.hidePopup();
}
</script
<table width="1000" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="width:1000px; height:10px; background-color:#999999;">
<table border="0" cellpadding="0" cellspacing="0" style="width:1000px; height:10px; background-color:#999999;">
<tr>
<td style="width:2px; height:10px; background-color:#999999;"><img src="http://pics.10026.com/?src=images/barleftvert.gif" width="2" height="10" style="border:0;" alt="" /></td>
<td style="width:996px; height:10px; background-color:#999999;"><img src="http://pics.10026.com/?src=images/spacer9.gif" width="996" height="1" alt="" /></td>
<td style="width:2px; height:10px; background-color:#999999;"><img src="http://pics.10026.com/?src=images/barrightvert.gif" width="2" height="10" alt="" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top" style="width:1000px;background-color:#999999;">
<table border="0" cellpadding="0" cellspacing="0" style="width:1000px; background-color:#999999;" id="Table6">
<tr>
<td style="width:2px; height:100%; background-color:#000000;"><img src="http://pics.10026.com/?src=images/barleftvert.gif" alt="" /></td>
<td style="width:10px;background-color:#999999;"><img src="http://pics.10026.com/?src=images/spacer9.gif" alt="" /></td
<td align="left" valign="top" class="log" style="background-color:#ffffff;width:976px;">
<table border="1" cellpadding="0" cellspacing="0"
style="width:976px; background-color:#ffffff; border-color:#000000;">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" id="Table9">
<tr>
<td style="height:10px;"> </td>
</tr>
<tr>
<td style="width:10px;"><img src="http://pics.10026.com/?src=images/spacerw.jpg" width="1" height="1" style="border:0;" alt="" /></td
<td align="left" valign="top">
<table cellpadding="0" cellspacing="0" style="background-color:#ffffff; border:0;">
<tr>
<td>
<table width="950" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td valign="top" style="width:100%;">
<table width="100%" border="0" cellpadding="0" cellspacing="1">
<tr>
<td class="bughead">
<asp:UpdatePanel ID="sorterUP" runat="server" UpdateMode="conditional"><ContentTemplate>
<asp:DropDownList ID="StateDDL" runat="server"
AutoPostBack="True"
CssClass="DDL" Font-Bold="true" BackColor="#efffff"
OnDataBinding="stateDDL_DataBinding"
OnSelectedIndexChanged="State_SelectedIndexChanged"
>
<asp:ListItem Value="1">Active</asp:ListItem>
<asp:ListItem Value="0">Closed</asp:ListItem>
<asp:ListItem Value="2">On Hold</asp:ListItem>
</asp:DropDownList> Bug Log <asp:Label ID="sortL" runat="server" Text="by Bug ID"></asp:Label>
</ContentTemplate></asp:UpdatePanel>
</td>
</tr>
<tr>
<td class="datehead">
</td>
</tr>
</table>
</td>

<td style="width:100%;"> </td>

<td style="width:490;" align="right" valign="top">
<table border="1" cellpadding="0" cellspacing="0" style="width:490px; height:60px; border-color:#000000;">
<tr>
<td valign="top">
<asp:UpdatePanel ID="postPanel" runat="server"
ChildrenAsTriggers="true" UpdateMode="always"
EnableViewState="true" RenderMode="inline" Visible="true"
>
<ContentTemplate>
<asp:GridView ID="postGrid" runat="server" DataSourceID="postODS"
GridLines="none" CssClass="postGrid" Width="490" ShowHeader="false" ShowFooter="false"
AutoGenerateColumns="false"
>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink id="post" runat="server"
Text='<%#
((int)DataBinder.Eval(Container.DataItem, "priority") == 1 ? "<blink><font color=red>" : "") +
(String.Format("{0:MM/dd HH:mm} ", DataBinder.Eval(Container.DataItem, "createDate"))) +
(((int)DataBinder.Eval(Container.DataItem, "priority") == 1) && ((int)DataBinder.Eval(Container.DataItem, "bugID") != 0) ? DataBinder.Eval(Container.DataItem, "bugID") : "") +
(((int)DataBinder.Eval(Container.DataItem, "priority") == 1) && ((int)DataBinder.Eval(Container.DataItem, "bugID") != 0) ? " (" + DataBinder.Eval(Container.DataItem, "type") + ") " : "") +
DataBinder.Eval(Container.DataItem, "post") +
((int)DataBinder.Eval(Container.DataItem, "priority") == 1 ? "</font></blink>" : "")
%>'
NavigateUrl='<%# buildURL(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "bugID"))) %>'
/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr></table>
</td>

<td style="width:10;" valign="top"> </td>
</tr></table>
<br />
</td>
</tr>

<tr>
<td style="width:100%;" align="left" valign="top">
hidden: <input type="text" id="hiddenLabel" runat="server" /><br />
invis:<asp:TextBox ID="invisLabel" runat="server" Visible="false"></asp:TextBox><br />
receiver: <asp:Label id="receiverLabel" runat="server" Text="nothing"></asp:Label>
<p>
</p
this builds on init: it works
<table id="buglog" border="0" cellspacing="0" cellpadding="1"
style="width:100%; background-color:transparent; border-color:#ffffff;">
<tr>
<td align="left" valign="top" style="width:400px;">
<asp:UpdatePanel ID="buggrid" UpdateMode="conditional" ChildrenAsTriggers="true" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView2" runat="server"
CssClass="buglog" HeaderStyle-BackColor="#bbbbbb" HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="#ffffff" BorderColor="White"
DataSourceID="bugs" DataKeyNames="bugID"
AllowSorting="True" AutoGenerateColumns="False"
OnSorted="GV2_Sorted" OnRowDataBound="GridView2_RowDataBound"
>
<Columns>
<asp:TemplateField HeaderText="Bug"
HeaderStyle-Font-Bold="true" HeaderStyle-Font-Size="33" HeaderStyle-CssClass="loghead" HeaderStyle-Font-Italic="false"
ItemStyle-Width="30" InsertVisible="False"
ItemStyle-HorizontalAlign="center"
SortExpression="bugID"
>
<ItemTemplate>
<asp:HyperLink id="bLink" runat="server"
Text='<%# Eval("bugID") %>'
NavigateUrl='<%# "viewbug.aspx?bugid="+ (int)DataBinder.Eval(Container.DataItem, "bugID")+ "&state=" + Convert.ToInt32(StateDDL.SelectedValue) %>'
/>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Priority" ItemStyle-Width="55" SortExpression="priority">
<ItemTemplate>
<asp:LinkButton ID="pLink" runat="server"
Text='<%# "<font color="+ ((string)DataBinder.Eval(Container.DataItem, "priority")=="Fix Now" || (string)DataBinder.Eval(Container.DataItem, "priority")=="911" ? "red":"black") + ">"+Eval("priority")+"</font>" %>'
CommandName="priority"
CommandArgument='<%# Eval("priority") %>'>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>

</Columns>
</asp:GridView>
</ContentTemplate>

<Triggers>
<asp:AsyncPostBackTrigger ControlID="StateDDL" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</td>

<td align="left" valign="top" style="width:400px;">
this builds dynamically: it does not work
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="conditional" ChildrenAsTriggers="true" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server"
CssClass="buglog" HeaderStyle-BackColor="#bbbbbb" HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="#ffffff" BorderColor="White"
DataSourceID="bugs" DataKeyNames="bugID"
AllowSorting="True" AutoGenerateColumns="False"
>
<Columns>
<asp:BoundField DataField="bugID" HeaderText="Bug" />

<asp:TemplateField HeaderText="Priority" ItemStyle-Width="55" SortExpression="priority">
<ItemTemplate>
<asp:LinkButton ID="pLink" runat="server"
Text='<%# "<font color="+ ((string)DataBinder.Eval(Container.DataItem, "priority")=="Fix Now" || (string)DataBinder.Eval(Container.DataItem, "priority")=="911" ? "red":"black") + ">"+Eval("priority")+"</font>" %>'
CommandName="priority" CommandArgument='<%# Eval("priority") %>'
OnClick="makePopup"
>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>

</Columns>
<HeaderStyle BackColor="#BBBBBB" Font-Bold="True" ForeColor="White" />
</asp:GridView
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</td
<td style="width:5px; background-color:#ffffff;"><img src="http://pics.10026.com/?src=images/spacerw.jpg" style="border:0;" alt="" /></td>
</tr>
</table>


<!-- for testing purposes: take out when go live -->
<p>
<asp:UpdatePanel ID="debuggerUP" runat="server" ChildrenAsTriggers="false" UpdateMode="conditional">
<ContentTemplate>
debugger: <asp:Label runat="server" ID="debugger" Text=""></asp:Label><br />
</ContentTemplate></asp:UpdatePanel>
<!--
for testing purposes: <br />
<asp:TextBox runat="server" ID="testText" Text="test"></asp:TextBox><br />
-->
</p>
<!-- end test -->


</td>
</tr>
</table>
</td>
</tr>
</table>
</td
<td style="width:10px;background-color:#999999;"><img src="http://pics.10026.com/?src=images/spacer9.gif" alt="" /></td>
<td style="width:2px; height:100%; background-color:#000000;"><img src="http://pics.10026.com/?src=images/barrightvert.gif" alt="" /></td>
</tr>
</table>
</td>

</tr>
</table
<asp:ObjectDataSource ID="bugs" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="getBugs" TypeName="easyQADataSetTableAdapters.buglog1TableAdapter">
<SelectParameters>
<asp:ControlParameter Name="stateID" ControlID="StateDDL"
DefaultValue="1" PropertyName="selectedValue" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</asp:Content>

code-behind:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Net;
using System.Net.Mail;
using System.Web;
using System.Web.Security;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using AjaxControlToolkit;
using easyQADataSetTableAdapters;

public partial class _Default : System.Web.UI.Page
{
/* global vars */
// date and time stuff
public string site = "../";
public DateTime now = DateTime.Now;

// connection string
public string cs;

// current page
public string curpage;

// public vars
public string bl, sb, up, a, r, alink, rlink;
public int blsize, sbsize, upsize, asize, rsize;
public string blimg, sbimg, upimg, aimg, rimg;

// link arrays
public LinkButton[] pArray;

// persistent vars
public int currentStateID
{
get
{
int id = (int)ViewState["currentStateID"];
return id;
}
set
{
ViewState["currentStateID"] = value;
}
}
public int noteRowID
{
get
{
int id = (int)ViewState["noteRowID"];
return id;
}
set
{
ViewState["noteRowID"] = value;
}
}
public int noteBugID
{
get
{
int id = (int)ViewState["noteBugID"];
return id;
}
set
{
ViewState["noteBugID"] = value;
}
}
public int uid
{
get
{
int id = (int)ViewState["uid"];
return id;
}
set
{
ViewState["uid"] = value;
}
}
public int aLevel
{
get
{
int id = (int)ViewState["aLevel"];
return id;
}
set
{
ViewState["aLevel"] = value;
}
}
public string uname
{
get
{
string id = (string)ViewState["uname"];
return id;
}
set
{
ViewState["uname"] = value;
}
}
public int pbRowID
{
get
{
int id = (int)ViewState["pbRowID"];
return id;
}
set
{
ViewState["pbRowID"] = value;
}
}

/* routines */
protected void Page_Init(object sender, EventArgs e)
{
// for local machine
cs = //"Provider=SQLOLEDB.1;" +
"Initial Catalog=easyQA;" +
"Data Source=KINDERGARTEN\\SQLEXPRESS;" +
"User ID=xxx;" +
"Password=xxx;" +
"Connect Timeout=15;" +
"Persist Security Info=True;" +
"Trusted_Connection=yes";

curpage = Page.Request.ServerVariables["SCRIPT_NAME"].ToString();
int l = curpage.LastIndexOf('/');
curpage = curpage.Remove(l, (curpage.Length - l));

// maybe move this to pageload?
((easyQAMasterPage)Master).navArgsSetup += new CommandEventHandler(setupAllNavArgs);
}

protected void Page_Load(object sender, EventArgs e)
{
currentStateID = Convert.ToInt32(StateDDL.SelectedValue);

if (Session.Count < 2)
Response.Redirect("index.aspx");

// setup page
createMasterLinks();

// postback specific stuff
if (Page.IsPostBack)
{
string pbLabel = hiddenLabel.Value;

// i also tried this:
// if (pbRowID != null) {
if (pbLabel != "") {
debugger.Text += "pbrID="+pbRowID;
buildPopup(pbRowID);
}
else
{
debugger.Text += "no pb ";
debuggerUP.Update();
}
DataBind();
}
else
{
if (Request.QueryString["state"] != null)
{
StateDDL.SelectedValue = Request.QueryString["state"];
}
currentStateID = Convert.ToInt32(StateDDL.SelectedValue);

uid = (int)Session["uid"];
aLevel = (int)Session["aLevel"];
uname = (string)Session["uname"];
}
}

protected void buildPopup(int rowID)
{
GridViewRow row = (GridViewRow)GridView1.Rows[rowID];
int bugID = Convert.ToInt32(GridView1.DataKeys[rowID].Value);

if (row.RowType == DataControlRowType.DataRow)
{
TableCell pcell = (row.Cells[1]) as TableCell;
Panel pPanel = new Panel();
PopupControlExtender pce = new PopupControlExtender();

// build priority popup for row
pce.ID = "pce" + rowID;
pcell.ID = "pcell" + rowID;
pPanel.ID = "pPanel" + rowID;
pPanel.CssClass = "popupMenu";

foreach (LinkButton l in pArray)
{
LinkButton newl = new LinkButton();

newl.ID = l.ID + rowID; ;
newl.Text = l.Text;
newl.Command += new CommandEventHandler(hit);
newl.CommandName = l.CommandName;
newl.CommandArgument = l.CommandArgument;
newl.OnClientClick = "closeWindow();";

pPanel.Controls.Add(newl);
}

pce.PopupControlID = pPanel.ID;
pce.TargetControlID = pcell.ID;
pce.OffsetX = 7;
pce.OffsetY = 7;
pce.Controls.Add(pPanel);
pcell.Controls.Add(pce);
}

pbRowID = rowID;
hiddenLabel.Value = rowID.ToString();
}

protected void makePopup(object sender, EventArgs e)
{
GridViewRow row = (GridViewRow)((Control)sender).Parent.Parent;
int rowID = row.RowIndex;
pbRowID = rowID;
hiddenLabel.Value = rowID.ToString();

//get rowID
buildPopup(rowID);
}

/*************** stuff i dont need to look at right now *******************/

/* build popup panels */
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
if ((e.Row.RowType == DataControlRowType.DataRow) && (currentStateID != 2))
{
GridViewRow row = (GridViewRow)e.Row;
int rowID = row.RowIndex;
int bugID = Convert.ToInt32(GridView2.DataKeys[rowID].Value);

TableCell pcell = (row.Cells[1]) as TableCell;
Panel pPanel = new Panel();
PopupControlExtender pce = new PopupControlExtender();

// build priority popup for row
pcell.ID = "pcell" + rowID;
pPanel.ID = "pPanel" + rowID;
pPanel.CssClass = "popupMenu";

foreach (LinkButton l in pArray)
{
LinkButton newl = new LinkButton();

newl.ID = l.ID + rowID; ;
newl.Text = l.Text;
newl.Command += new CommandEventHandler(updateRecord);
newl.CommandName = l.CommandName;
newl.CommandArgument = l.CommandArgument;
newl.OnClientClick = "closeWindow();";

pPanel.Controls.Add(newl);
}

pce.ID = "pce" + rowID;
pce.PopupControlID = pPanel.ID;
pce.TargetControlID = pcell.ID;
pce.OffsetX = 7;
pce.OffsetY = 7;
pce.Controls.Add(pPanel);
pcell.Controls.Add(pce);
}
}

/* full updating of record (pre present post) */
protected void updateRecord(object sender, CommandEventArgs e)
{
debugger.Text += "leadweight ";
debuggerUP.Update();
}

protected void hit(object sender, CommandEventArgs e)
{
debugger.Text += "dynamic ";
debuggerUP.Update();
}

/* build master links to copy to popup panels */
protected void createMasterLinks()
{
SqlConnection conn = new SqlConnection(cs);
SqlCommand cmd = new SqlCommand();
SqlDataReader dr;
int i = 0;
cmd.CommandText = "select count(*) from priority";

// init arrays
cmd.Connection = conn;
conn.Open();
int pCount = Convert.ToInt32(cmd.ExecuteScalar());
pArray = new LinkButton[pCount];

// build priority links
i = 0;
cmd.CommandText = "priorities";
cmd.CommandType = CommandType.StoredProcedure;
dr = cmd.ExecuteReader();
while (dr.Read())
{
int pID = dr.GetInt32(0);
string p = dr.GetString(1).ToString();
Label newlabel = new Label();
LinkButton l = new LinkButton();

//string arg = Convert.ToString(rowID) + "," + Convert.ToString(pID);
string arg = Convert.ToString(pID);

l.ID = "priority" + pID;
l.Text = p + "<br>";
l.Command += new CommandEventHandler(updateRecord);
l.CommandName = "priority";
l.CommandArgument = arg;

pArray[i++] = l;
}
dr.Close();
cmd.Dispose();
conn.Close();
}

/* set the viewstate stateID */
protected void State_SelectedIndexChanged(object sender, EventArgs e)
{
currentStateID = Convert.ToInt32(StateDDL.SelectedValue);
}

/* set selected value */
protected void stateDDL_DataBinding(object sender, EventArgs e)
{
}

/* setup page header */
private void setupAllNavArgs(object sender, CommandEventArgs e)
{
string c = e.CommandName;
string val = e.CommandArgument.ToString();

string[] args = val.Split(new char[] { ',' });
bl = args[0];
sb = args[1];
up = args[2];
a = args[3];
r = args[4];

blimg = "<IMG src='images/" + bl + "_off.gif' WIDTH='135' HEIGHT='22' BORDER='0' ALT='Bug Log' NAME='" + bl + "'>";
sbimg = "<IMG src='images/" + sb + "_off.gif' WIDTH='135' HEIGHT='22' BORDER='0' ALT='Submit Bug' NAME='" + sb + "'>";
upimg = "<IMG src='images/" + up + "_off.gif' WIDTH='135' HEIGHT='22' BORDER='0' ALT='User Prefs' NAME='" + up + "'>";
aimg = "<IMG src='images/" + a + "_off.gif' WIDTH='135' HEIGHT='22' BORDER='0' ALT='Admin' NAME='" + a + "'>";
rimg = "<IMG src='images/" + r + "_off.gif' WIDTH='135' HEIGHT='22' BORDER='0' ALT='Reports' NAME='" + r + "'>";

// nav menu logic
switch (curpage)
{
case "buglog.aspx":
bl = "big" + bl;
blsize = 160;
blimg = "<IMG src='images/" + bl + "_off.gif' WIDTH='160' HEIGHT='26' BORDER='0' ALT='Bug Log' NAME='" + bl + "'>";
break;

case "viewbug.aspx":
bl = "big" + bl;
blsize = 160;
blimg = "<IMG src='images/" + bl + "_off.gif' WIDTH='160' HEIGHT='26' BORDER='0' ALT='Bug Log' NAME='" + bl + "'>";
break;

case "submitbug.aspx":
sb = "big" + sb;
sbsize = 160;
sbimg = "<IMG src='images/" + sb + "_off.gif' WIDTH='160' HEIGHT='26' BORDER='0' ALT='Submit' NAME='" + sb + "'>";
break;

case "userprefs.aspx":
up = "big" + up;
upsize = 160;
upimg = "<IMG src='images/" + up + "_off.gif' WIDTH='160' HEIGHT='26' BORDER='0' ALT='User Prefs' NAME='" + up + "'>";
break;

case "admin.aspx":
a = "big" + a;
asize = 160;
aimg = "<IMG src='images/" + a + "_off.gif' WIDTH='160' HEIGHT='26' BORDER='0' ALT='Admin' NAME='" + a + "'>";
break;

case "reports.aspx":
r = "big" + r;
rsize = 160;
rimg = "<IMG src='images/" + r + "_off.gif' WIDTH='160' HEIGHT='26' BORDER='0' ALT='Reports' NAME='" + r + "'>";
break;
}

}

// build the url for the post link
public string buildURL(int bugID)
{
if (bugID != 0)
{
return ("viewbug.aspx?bugid=" + bugID);
}
return "";
}

// get the sort name for the header
protected void GV2_Sorted(object sender, EventArgs e)
{
string sorter = GridView2.SortExpression;

switch (sorter)
{
case "bugID":
sorter = "Bug ID";
break;
case "priority":
sorter = "Priority";
break;
case "type":
sorter = "Type";
break;
case "subtype":
sorter = "SubType";
break;
case "descShort":
sorter = "Description";
break;
case "nameQA":
sorter = "Assigned";
break;
case "status":
sorter = "Status";
break;
case "createDate":
sorter = "Created";
break;
case "groupname":
sorter = "Group";
break;

}
sortL.Text = "by " + sorter;
sorterUP.Update();
}


Hi,

To be more accurate, what I want is a sample that I can copy and run.

It will be preferred if unrelated code can be stripped off, and use a common database(e.g., northwind). No rely on a 3rd party library.

I can send you a mail, please reply and attach a sample in it.


hey i figured out the problem to my problem
which sort of goes to the issue of tracking events
this was actually a problem dating back to the migration of my project from classic to asp to asp.net2.0

here is the offending code:

<a href="http://links.10026.com/?link=./submitbug.aspx"
onmouseover="rollover('<%=sb%>', 'images/<%=sb%>_on.gif')"
onmouseout="rollover('<%=sb%>', 'images/<%=sb%>_off.gif')">
<%=sbimg%></a>

and

sbimg = "<IMG src='images/" + sb + "_off.gif' WIDTH='160' HEIGHT='26' BORDER='0' ALT='Submit' NAME='" + sb + "'>";

where sb was = "submit"
once i changed sb = "submitbug" everything was ok

(if you work out everything, asp.net2.0 compiles the 'submit' as a submit button
whereas classic just let it be what *i* wanted it to be)

yeah - so if there were an event tracker - it would have helped to track this down
but right now im just happy i found this out

hope this helps some people out there

No comments:

Post a Comment