Showing posts with label link. Show all posts
Showing posts with label link. Show all posts

Wednesday, March 28, 2012

Multiple UpdatePanels require their controls to enable ViewState?

I've got 2 update panels on the same page. up1 contains a link button and up2 contains a repeater. I don't need or want the repeater in up2 to be added to Viewstate. However, when up1's link button is clicked, the async call works fine but on return it clears out up2's content. If I set the repeater in up2 to enable viewstate, it then works. If upatepanels are supposed to implement partial page updates, why does up1 wipe out up2's content if up2's content is not in viewstate?

A wild stab in the dark : Is up2.UpdateMode set to "Condtional" ?? if not, then it has a default mode "Always", and gets refreshed on each async postback. If you do not redraw the repeater at that time, or get it from viewstate, then well - you get zilch :)


Ah, yes, that's it. I would have thought the default updatemode would be "Conditional" rather than "Always". Having all the updatepanels update seems counterintuitive to the idea of a partial page update. Anyway, thanks.

Monday, March 26, 2012

Must Click Twice for Event to Fire

I have an GridView with an Select link on each line. The link brings up a modal popup for editing data. The GridView is inside an updatepanel.

Everything works great, except for some reason, I have to click the Select link twice for the event to fire. The first click does nothing...does not enter the

SelectedIndexChanged event at all.

Anyone know why?

Wanna post your HTML here so we can take a peek?

WS


Sure here you go..

<%

@.ControlLanguage="vb"AutoEventWireup="false"Codebehind="Packer.ascx.vb"Inherits="WDE.Packer" %>

<%

@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>

<

divid="PackerUpdatePanel"><asp:UpdatePanelID="UpdatePanelPackers"runat="server"UpdateMode="Conditional"><ContentTemplate><asp:PanelID="PanelPackersHeader"runat="server"CssClass="collapsePanelHeader"Height="30px"><divstyle="padding: 5px; vertical-align: middle;"><divstyle="float: left;"><asp:LabelID="LblPackers"runat="server"Text="Packers"></asp:Label></div><divstyle="float: left; margin-left: 5px;"><asp:LabelID="LblPackersCount"runat="server"></asp:Label></div><divstyle="float: right; vertical-align: middle; cursor: hand"><asp:ImageButtonID="ImageExpand"runat="server"ImageUrl="~/images/expand_blue.jpg"/></div><divstyle="float: right; margin-right: 20px;"></div></div></asp:Panel><asp:PanelID="PanelPackersViewDetails"runat="server"Height="100%"Width="100%"Wrap="False"><tableid="border"width="100%"cellpadding="0"cellspacing="0"><tr><tdclass="addHeader"><divstyle="float: right; margin-right: 1px;cursor: hand"><asp:LinkButtonID="HyperLinkAddPacker"runat="server"OnClick="HyperLinkAddPacker_Click"ForeColor="White"CssClass="hyperlinkNoLine">Add New Packer</asp:LinkButton></div></td></tr><tr><td><asp:GridViewID="packerGrid"runat="server"CellPadding="4"DataSourceID="PackersXmlDataSource"Width="100%"ForeColor="#333333"AutoGenerateColumns="False"GridLines="None"OnSelectedIndexChanged="packerGrid_SelectedIndexChanged"><FooterStyleBackColor="#5D7B9D"Font-Bold="True"ForeColor="White"/><RowStyleBackColor="#F7F6F3"ForeColor="#333333"/><EditRowStyleBackColor="#999999"/><SelectedRowStyleBackColor="#E2DED6"Font-Bold="True"ForeColor="#333333"/><PagerStyleBackColor="#284775"ForeColor="White"HorizontalAlign="Center"/><HeaderStyleBackColor="#5D7B9D"Font-Bold="True"ForeColor="White"/><AlternatingRowStyleBackColor="White"ForeColor="#284775"/><Columns><asp:CommandFieldShowSelectButton="True"SelectText="Edit"/><asp:BoundFieldDataField="packerDate"HeaderText="Date"SortExpression="packerDate"><ItemStyleHorizontalAlign="Left"/><HeaderStyleHorizontalAlign="Left"/></asp:BoundField><asp:BoundFieldDataField="packerOperation"HeaderText="Operation"SortExpression="packerOperation"><HeaderStyleHorizontalAlign="Left"/><ItemStyleHorizontalAlign="Left"/></asp:BoundField><asp:BoundFieldDataField="packerCode"HeaderText="Code"SortExpression="packerCode"><HeaderStyleHorizontalAlign="Left"/><ItemStyleHorizontalAlign="Left"/></asp:BoundField><asp:BoundFieldDataField="packerDepth"HeaderText="Depth"SortExpression="packerDepth"><HeaderStyleHorizontalAlign="Left"/><ItemStyleHorizontalAlign="Left"/></asp:BoundField><asp:CommandFieldButtonType="Image"DeleteImageUrl="~/Images/DELETE.jpg"ShowDeleteButton="True"/></Columns></asp:GridView></td></tr></table></asp:Panel><ajaxToolkit:CollapsiblePanelExtenderID="CollapsiblePanelExtenderPackers"runat="Server"TargetControlID="PanelPackersViewDetails"ExpandControlID="ImageExpand"CollapseControlID="ImageExpand"Collapsed="True"ExpandedImage="~/images/collapse_blue.jpg"CollapsedImage="~/images/expand_blue.jpg"ImageControlID="ImageExpand"SuppressPostBack="true"/></ContentTemplate></asp:UpdatePanel>

</

div>

<

divid="PackersMaintenancePanelDiv"><asp:ButtonID="FakePackerTarget"runat="server"Style="display: none"></asp:Button><ajaxToolkit:ModalPopupExtenderID="ModalPopupAddEditPacker"runat="server"TargetControlID="FakePackerTarget"PopupControlID="PanelPackerAddEdit"BackgroundCssClass="modalBackground"DropShadow="false"CancelControlID="btnCancel"/><asp:PanelID="PanelPackerAddEdit"runat="server"Width="45%"Wrap="False"Style="display: none"BorderStyle="Solid"BorderColor="#6b8aad"><asp:UpdatePanelID="UpdatePanelPackerModalPopup"runat="server"><ContentTemplate><tableid="AddPackTable"runat="server"style="width: 100%; background-color: white;"><tr><tdcolspan="3"style="font-size: 10pt; background-color: #6b8aad; color: White"><asp:LabelID="lblPackerHeader"runat="server"Text="Packer"></asp:Label></td></tr><tr><td><asp:LabelID="lblPackerDate"runat="server"Text="Date:"Width="78px"></asp:Label><br/></td><td><asp:TextBoxID="txtPackerDate"runat="server"></asp:TextBox><spanstyle="font-size: 10pt; color: #ff0033">* </span><asp:ImageButtonID="ImageBtnCalendar"runat="server"ImageUrl="~/Images/CalendarButton.gif"/><ajaxToolkit:PopupControlExtenderID="PopupControlExtenderPackerDate"runat="server"TargetControlID="ImageBtnCalendar"PopupControlID="PanelCalendar"Position="Bottom"/><spanstyle="font-size: 10pt">(yyyymmdd)</span></td><td><asp:RequiredFieldValidatorID="RequiredFieldValidator2"runat="server"ControlToValidate="txtPackerDate"ErrorMessage="RequiredFieldValidator"Display="Dynamic">Date is required.</asp:RequiredFieldValidator></td></tr><tr><td><asp:LabelID="lblPackerOperation"runat="server"Text="Operation:"></asp:Label></td><td><asp:RadioButtonListID="rblPakerOperation"runat="server"RepeatDirection="Horizontal"><asp:ListItemSelected="True"Value="P">Pulled</asp:ListItem><asp:ListItemValue="S">Set</asp:ListItem></asp:RadioButtonList></td><td></td></tr><tr><td><asp:LabelID="lblPackerCode"runat="server"Text="Code:"></asp:Label></td><td><asp:TextBoxID="txtBoxPackerCode"runat="server"></asp:TextBox><asp:ButtonID="btnPackerCodes"runat="server"Text=".."/><ajaxToolkit:PopupControlExtenderID="PopupControlExtenderPackerCodes"runat="server"TargetControlID="btnPackerCodes"PopupControlID="PanelPackerCode"Position="Bottom"/></td><td></td></tr><tr><td><asp:LabelID="lblPackerDepth"runat="server"Text="Depth:"></asp:Label></td><td><asp:TextBoxID="txtboxPackerDepth"runat="server"MaxLength="7"></asp:TextBox>mkb<spanstyle="font-size: 10pt; color: #ff0033">*</span></td><td><asp:RequiredFieldValidatorID="RequiredFieldValidator1"runat="server"ControlToValidate="txtboxPackerDepth"ErrorMessage="RequiredFieldValidator"Display="Dynamic">Depth is required.</asp:RequiredFieldValidator></td></tr><tr><tdcolspan="3"><hr/></td></tr><tr><td><spanstyle="color: #ff0033"><spanstyle="font-size: 10pt; color: #ff0033">*</span></span>-Required</td><td></td><tdstyle="width: 100%"><asp:ButtonID="btnPackerAddOk"runat="server"Text="Ok"/><asp:ButtonID="btnCancel"runat="server"Text="Cancel"OnClick="btnCancel_Click"CausesValidation="False"/></td></tr></table></ContentTemplate></asp:UpdatePanel></asp:Panel>

</

div>

<

divid="PanelCalendarDiv"><asp:PanelID="PanelCalendar"runat="server"CssClass="popupControl"Style="z-index: 10002"><asp:UpdatePanelID="UpdatePanelCalendar"runat="server"UpdateMode="Always"><ContentTemplate><center><asp:CalendarID="Calendar1"runat="server"BackColor="White"BorderColor="#999999"CellPadding="1"DayNameFormat="Shortest"Font-Names="Verdana"Font-Size="8pt"ForeColor="Black"Width="160px"OnSelectionChanged="Calendar1_SelectionChanged"><SelectedDayStyleBackColor="#666666"Font-Bold="True"ForeColor="White"/><TodayDayStyleBackColor="#CCCCCC"ForeColor="Black"/><SelectorStyleBackColor="#CCCCCC"/><WeekendDayStyleBackColor="#FFFFCC"/><OtherMonthDayStyleForeColor="#808080"/><NextPrevStyleVerticalAlign="Bottom"/><DayHeaderStyleBackColor="#CCCCCC"Font-Bold="True"Font-Size="7pt"/><TitleStyleBackColor="#999999"Font-Size="7pt"BorderColor="Black"Font-Bold="True"/></asp:Calendar></center></ContentTemplate></asp:UpdatePanel></asp:Panel>

</

div>

<

divid="PanelPackerCodeDiv"><asp:PanelID="PanelPackerCode"runat="server"CssClass="popupControl"Style="z-index: 10003"><asp:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><asp:RadioButtonListID="RblPackerCodes"runat="server"OnSelectedIndexChanged="RblPackerCodes_SelectedIndexChanged"AutoPostBack="true"><asp:ListItemValue="1">1 - Packer</asp:ListItem><asp:ListItemValue="2">2 - Bridge plug or whipstock packer</asp:ListItem><asp:ListItemValue="3">3 - Cement retainer</asp:ListItem><asp:ListItemValue="4">4 - Through tubing packer</asp:ListItem><asp:ListItemValue="5">5 - Through tubing bridge plug</asp:ListItem></asp:RadioButtonList></ContentTemplate></asp:UpdatePanel></asp:Panel>

</

div>

<

asp:XmlDataSourceID="PackersXmlDataSource"runat="server"DataFile="~/XML/Packers.xml">

</

asp:XmlDataSource>

<

asp:ObjectDataSourceID="PackersObjectDataSource"runat="server"DataObjectTypeName="Packer"DeleteMethod="DeletePacker"SelectMethod="GetPackers"TypeName="WellOperation"UpdateMethod="UpdatePacker"></asp:ObjectDataSource>

I'm having the same problem and have tried for 2 weeks to resolve without success. I have converted to the RC AJAX - still same issue. I have suspected that the problem revolves around a custom user control that is on my form. It is simply an alphabet selector with 26 letters as links.

I have traced the events and on the first click, the code goes as far as the constructor code for the user control and then simply stops. But then, as Janet wrote, the second click works just fine.

Wednesday, March 21, 2012

Need help with hover menu on repeater rows..

Hi all! I am trying to use Hover Menu... on the rows generated by asp repeater.. and add EDIT and DELETE Link buttons in the menu... In on of the post in this forum I found that we need to initilize for every row.. I confused.. it wud be gr8 if any help me with some sample code...

<asp:Panel runat="server" ID="pnlcurroffer" GroupingText="<b>Current Offers Info</b>" Height="400px" Width="350" >
<asp:Button ID="btncurrprev" runat="server" CssClass="tbox" Text="<<" OnClick="currprev" />
<asp:Label ID="lblcurrpage" runat="server" />
<asp:Button ID="btncurrnxt" runat="server" CssClass="tbox" Text=">>" OnClick="currlnext" /
<table cellpadding="0" cellspacing="0" border="0" class="main" width="95%"
<tr>
<td colspan="4" class="top line"><img src="http://pics.10026.com/?src=~../images/spc.gif" height="2" width="1" alt="" /></td>
</tr>
<tr>
<td class="hed" style="height: 19px"><div class="mgn">ID</div></td>
<td class="hed" style="height: 19px"><div class="mgn">Name</div></td>
<td class="hed" style="height: 19px"><div class="mgn">PackInfo</div></td>
<td class="hed" style="height: 19px"><div class="mgn">Del</div></td>

</tr>
<tr>
<asp:Repeater ID="Repcurroffers" runat="server" OnItemDataBound="bindcurroffers" >
<ItemTemplate>
<tr class="white" onmouseover="this.className='high';" onmouseout="this.className='white';">
<td class="row"><div class="mgn"><%#Eval("spid")%></div></td>
<td class="row"><div class="mgn"><asp:Literal ID="lblcurroffname" runat="server" /></div></td>
<td class="row"><div class="mgn"><asp:Literal ID="lblcurrLead" runat="server" /></div></td>
<td class="row"><div class="mgn"><asp:LinkButton ID="lnkdel" runat="server" Text="Delete" CommandArgument='<%#Eval("Spid")%>' OnCommand="lnkDelOffer" /></div></td>
</tr>
</ItemTemplate>

</asp:Repeater>
</tr>
</table>
</asp:Panel>

Thanx guys

Hi,

Please change your code to:

<asp:Panel runat="server" ID="pnlcurroffer" GroupingText="<b>Current Offers Info</b>"
Height="400px" Width="350">
<asp:Button ID="btncurrprev" runat="server" CssClass="tbox" Text="<<" OnClick="currprev" />
<asp:Label ID="lblcurrpage" runat="server" />
<asp:Button ID="btncurrnxt" runat="server" CssClass="tbox" Text=">>" OnClick="currlnext" />
<table cellpadding="0" cellspacing="0" border="0" class="main" width="95%">
<tr>
<td colspan="4" class="top line">
<img src="http://pics.10026.com/?src=~../images/spc.gif" height="2" width="1" alt="" /></td>
</tr>
<tr>
<td class="hed" style="height: 19px">
<div class="mgn">
ID</div>
</td>
<td class="hed" style="height: 19px">
<div class="mgn">
Name</div>
</td>
<td class="hed" style="height: 19px">
<div class="mgn">
PackInfo</div>
</td>
<td class="hed" style="height: 19px">
<div class="mgn">
Del</div>
</td>
</tr>
<asp:Repeater ID="Repcurroffers" runat="server" OnItemDataBound="bindcurroffers">
<ItemTemplate>
<tr>
<td colspan="4">
<asp:Panel ID="Panel1" runat="server">

<table>
<tr class="white" onmouseover="this.className='high';" onmouseout="this.className='white';">
<td class="row">
<div class="mgn">
<%#Eval("spid")%>
</div>
</td>
<td class="row">
<div class="mgn">
<asp:Literal ID="lblcurroffname" runat="server" /></div>
</td>
<td class="row">
<div class="mgn">
<asp:Literal ID="lblcurrLead" runat="server" /></div>
</td>
<td class="row">
<div class="mgn">
<asp:LinkButton ID="lnkdel" runat="server" Text="Delete" CommandArgument='<%#Eval("Spid")%>'
OnCommand="lnkDelOffer" /></div>
</td>
</tr>
</table>
</asp:Panel>
<ajaxToolkit:HoverMenuExtender ID="hme1" runat="Server" TargetControlID="Panel1"
PopupControlID="PopupMenu" HoverCssClass="popupHover" PopupPosition="Right" />
<asp:Panel ID="PopupMenu" runat="server" CssClass="popupMenu">
<div style="border: 1px outset white">
<asp:LinkButton ID="LinkButton1" runat="server" />
<br />
<asp:LinkButton ID="LinkButton2" runat="server" />
</div>
</asp:Panel>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>

</table>
</asp:Panel>

Best Regards,


Thank you so much!!!