473,748 Members | 5,429 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DropDownList inside GridView won't fire any longer! aka - I moved a page to another web-site and now it's broke!

I moved a page to another web-site and now it's broke!

I had 5 pages in their own web-site. These pages have now been moved
to another web-site. Everything is fine except that one of the pages,
which I had trouble with in the past (i.e. same problem), is now
partly broke. The paging no longer fully works in the gridview.

The gvAwarded_RowDa taBound code works to load the ddlPager with the
correct number of pages.

The lnkPagerBack, and lnkPager controls continue to work at
incrementing and decrementing the page count but the ddlPager,
DropDownList, does not even post back when I click it (i.e. in debug
mode it does not run the server event).

What have I done wrong!

PS: The PagerTemplate has now been AJAXified (but it doesn't work
without the AJAX anyhow!, so I can't see how AJAX could be an issue -
although, the new site has some AJAX and the old site (from which it
was moved) has none.).

I've put the relevant code below.
<form id="frmPensions " runat="server">
<asp:ScriptMana ger ID="ScriptManag er1" runat="server" />

<asp:GridView ID="gvAwarded" AllowPaging="tr ue" AllowSorting="t rue"
AutoGenerateCol umns="false"
PageSize="20" DataKeyNames="A ctivityID" Runat="server"
CssClass="Grid" CellSpacing="2" BorderWidth="0p x" CellPadding="4"
EmptyDataText=" Non available"
OnRowDataBound= "gvAwarded_RowD ataBound"
OnSorting="gvAw arded_Sorting">

<AlternatingRow Style CssClass="Alter natingRow" BackColor="#d8d eEE"
VerticalAlign=" Top" />
<HeaderStyle CssClass="GridH eader" BackColor="#666 699"
HorizontalAlign ="Left" Font-Bold="True" ForeColor="Whit e"
Height="17px" VerticalAlign=" Top" />
<RowStyle CssClass="GridR ow" BackColor="Whit e"
VerticalAlign=" Top" />
<PagerStyle ForeColor="Whit e" BackColor="#666 699" Font-Bold="True"
CssClass="GridP ager" />

<PagerTemplat e>
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<div id="PageRow">
<asp:label id="MessageLabe l" CssClass="lblPa geMessage"
forecolor="Whit e" Font-Bold="true"
text="Select a page:"
Runat="server" />
<asp:DropDownLi st id="ddlPager" AutoPostBack="t rue"
ForeColor="Whit e" BackColor="#666 699" Font-Bold="true"
OnSelectedIndex Changed="ddlPag er_SelectedInde xChanged"
Runat="server" /&nbsp;
<asp:LinkButt on ID="lnkPagerBac k" ForeColor="Whit e"
ToolTip="Previo us"
runat="server" OnClick="lnkPag erBack_Click"
CssClass="lblPa geArrow"< </asp:LinkButton& nbsp;
<asp:LinkButt on ID="lnkPager" ForeColor="Whit e" ToolTip="Next"
runat="server" OnClick="lnkPag er_Click" CssClass="lblPa geArrow">
</asp:LinkButton>
<asp:label id="CurrentPage Label"
forecolor="Whit e" Font-Bold="true" Width="30%"
CssClass="lblPa geCurrent"
Runat="server" />
<asp:HiddenFiel d ID="txtPageInde x" runat="server" />
</div>
</ContentTemplate >
</asp:UpdatePanel >
</PagerTemplate>

<Columns>
<asp:BoundFie ld DataField="Cons ultantName" HeaderText="Con sultant"
SortExpression= "ConsultantName ">
<ItemStyle Width="15%" CssClass="acol1 " />
</asp:BoundField>
<asp:BoundFie ld DataField="Mana gerName" HeaderText="Man ager"
SortExpression= "ManagerNam e">
<ItemStyle Width="15%" CssClass="acol2 " />
</asp:BoundField>
<asp:BoundFie ld DataField="Asse tClassList" HeaderText="Ass et Class"
SortExpression= "AssetClassList ">
<ItemStyle Width="15%" CssClass="acol3 " />
</asp:BoundField>
<asp:BoundFie ld DataField="Amou nt" HeaderText="Amo unt"
SortExpression= "Amount" DataFormatStrin g="{0:GBP ###,### m; n/a}"
HtmlEncode="Fal se">
<ItemStyle Width="7%" CssClass="acol4 " />
</asp:BoundField>
<asp:BoundFie ld DataField="Pens ionFundName" HeaderText="Inv estor"
SortExpression= "PensionFundNam e">
<ItemStyle Width="20%" CssClass="acol5 " />
</asp:BoundField>
<asp:BoundFie ld DataField="Styl e" HeaderText="Sty le"
SortExpression= "Style" >
<ItemStyle Width="8%" CssClass="acol6 " />
</asp:BoundField>
<asp:BoundFie ld DataField="Coun tryName" HeaderText="Cou ntry"
SortExpression= "CountryNam e">
<ItemStyle Width="8%" CssClass="acol7 " />
</asp:BoundField>
<asp:BoundFie ld DataField="Entr yDate" HeaderText="Ent ry Date"
SortExpression= "EntryDate" HtmlEncode="Fal se" DataFormatStrin g ="{0:dd
MMM yyyy}">
<ItemStyle Width="11%" CssClass="acol8 " />
<HeaderStyle CssClass="ahcol 8" />
</asp:BoundField>
</Columns>
</asp:GridView>
</form>
....
protected void ddlPager_Select edIndexChanged( object sender, EventArgs
e)
{
GridViewRow pagerRow = gvAwarded.Botto mPagerRow;
DropDownList pageList;
if (pagerRow != null)
{
pageList = (DropDownList)p agerRow.Cells[0].FindControl("d dlPager");
gvAwarded.PageI ndex = pageList.Select edIndex;
}
BindGridView();
}
protected void lnkPager_Click( object sender, EventArgs e)
{
gvAwarded.PageI ndex++;
BindGridView();
}
protected void lnkPagerBack_Cl ick(object sender, EventArgs e)
{
if(gvAwarded.Pa geIndex 0)
gvAwarded.PageI ndex--;
BindGridView();
}

protected void gvAwarded_RowDa taBound(object sender,
GridViewRowEven tArgs e)
{
if (e.Row.RowType == DataControlRowT ype.Header)
{
foreach (TableCell tc in e.Row.Cells)
{
tc.Attributes.A dd("title", "Sort");
}
}
if (e.Row.RowType == DataControlRowT ype.DataRow)
{
e.Row.Cells[5].Text =
PensionWatch.St yleCodeToWord(e .Row.Cells[5].Text);
}
if (e.Row.RowType == DataControlRowT ype.Pager)
{
DropDownList pageList =
(DropDownList)e .Row.Cells[0].FindControl("d dlPager");
Label pageLabel =
(Label)e.Row.Ce lls[0].FindControl("C urrentPageLabel ");

for (int i = 0; i < gvAwarded.PageC ount; i++)
{
int pageNumber = i + 1;
ListItem item = new ListItem(pageNu mber.ToString() );
if (i == gvAwarded.PageI ndex)
item.Selected = true;
pageList.Items. Add(item);
}
int currentPage = gvAwarded.PageI ndex + 1;
pageLabel.Text = "Page " + currentPage.ToS tring() + " of " +
gvAwarded.PageC ount.ToString() ;
}

Mar 26 '07 #1
1 2704
Apologies for the post. I have fixed it now. The problem was that I
added two lines to Page_Load() (shown below, commented out). That was
because the page was sometimes loading with no data in the GridView!,
I guess I need to deal with that some other way. The AJAX is no good
either the entire GridView needs to be AJAXified or none of it.
protected void Page_Load(objec t sender, EventArgs e)
{
cmdMandatewire. Attributes.Add( "onmouseove r",
"MenuButtonIn(t his);");
cmdMandatewire. Attributes.Add( "onmouseout ",
"MenuButtonOut( this);");
if (!Page.IsPostBa ck)
{
LoadData();
Session["SortExpression "] = "EntryDate" ;
Session["SortDirect ion"] = "DESC";
}
//else
// BindGridView();
}

Mar 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2049
by: Ali | last post by:
I am adding a DropDownList control to my DataGrid footer template. I load my DropDownList using a function that returns an arrayList. I can see all my items in the DropDownList, but when I select an item from the list, I am unable to trap the DropDownList SelectedIndexChanged event. This is a snippet of my DataGrid: <asp:TemplateColumn> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "State") %>
0
3503
by: keithb | last post by:
With a DropDownList in a GridView Edit Template, how can I set the SelectedIndex property so that the list initializes to the value shown in the Display template? When I set SelectedIndex to -1, the DropDownList initializes to the first entry. <asp:DropDownList ID="DropDownList2" runat="server" Width="75px"
0
2138
by: dawg1998 | last post by:
I am able to populate a DropDownList control within multiple rows of a GridView with the following code: `````````````````````````````````````````````````````` <asp:GridView id="gvGridView" runat="server" AutoGenerateColumns="False" DataKeyNames="idRecordID"> <Columns> <asp:TemplateField> <ItemTemplate>
0
2389
by: den 2005 | last post by:
Hi everybody, I created a Gridview with a TemplateField and there is Label control in ItemTemplate and a DropdownList control in EditItemTemplate, I was to displayed them ok when I click the Edit Command button. But when I about to get the value of this template field I get an empty string value. I check the following the local dtFiles has data and the cells are visible at stage right before foreach GridViewRow gr in gdvFiles.Rows) loop....
3
1646
by: Jon Paal | last post by:
this text keeps showing up in my gridview dropdownlist "System.Data.DataRowView" How do I prevent this problem ?
0
5962
by: sgtmarcjones | last post by:
How do I access a dropdownlist that is nested within a Formview ItemTemplate Gridview Template? I want to see a label (lgbTimeKeep ! TextValue of ddlName dropdownlist) instead of a dropdownlist in the FormView ItemTemplate Nested Gridview ddlName ItemTemplate. My label is named lgvTimeKeep and the dropdownlist name is ddlName. Thanks!
1
13579
by: kageyone | last post by:
I have a gridview in .net 2.0 with a dropdownlist of two items - that being "active" and "inactive". <EditItemTemplate> <asp:DropDownList ID="ddlStatus" runat="server" AutoPostBack="true"> <asp:ListItem Text="active" Value="active"></asp:ListItem> <asp:ListItem Text="inactive" Value="inactive"></asp:ListItem </asp:DropDownList> </EditItemTemplate> I also have AutoGenerateEditButton="true"...
3
1962
by: S_K | last post by:
I have a GridView that has a DropDownList in one of the columns. When I edit and update any row I would like to grab the SelectedValue of that DropDownList when I'm in the GridView_RowUpdating event. Any ideas?
0
2147
by: baburk | last post by:
I am having dropdownlist inside gridview. When the dropdownlist selectedindex change an event should fire. What is the event for his. I also want to get the dropdownlist event fired row number <asp:GridView ID = "gvMaterials" runat = "server" AutoGenerateColumns = "false"> <Columns>
2
2114
by: baburk | last post by:
I have Two DropDownList inside DataGrid or GridView, Now on Change of selection of First DropDownList, I want to fill value in second DropDownList
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.