Showing posts with label load. Show all posts
Showing posts with label load. Show all posts

Wednesday, March 28, 2012

Dynamic Gridview

Hi!

I've got a quetion on dynamic gridview load. In my atlas website project i have a gridview that i want to load dynamically. That is, I don't want to load all the data in my datasource because the web page could charge slowly; so, i want to charge only part of the data as fast as possible then, load the other paghes when the user asks for it. How can I do it? Am I to write a C# class in order to manage the load?

Thanks

hi,

it depends on what level do u want to do this ,at what level is it loading slowly.....1)from the dataserver to the dataobject or 2)the control to the current instance of the page...?


it downloads slowly from the dataserver to the dataobject

where is your select query placed?may be in datasource...... place it in a stored procedure as stored procedures are precompiled..... & call the stored procedure....also set EnablePaging to true of the gridview.


My query select is placed in my datasource and my EnablePaging is set to true

Dynamic content paired with a popupControlextender

Hi folks,

I have implemented a popup control exteder which works great, however I have to populate the content of the popup at page load. I would like the content of the popup to be dynamically generated at the time the popup is called with a server callback, kind of a PopupControlExtender meets DynamicPopulateExtender. I guess what i'm looking for is just an indication of the complexity of this task, and perhaps a pointer in the right direction.

Cheers,

Howard

Hi,

Actually, PopupControl has this functionality built in... you can set the DynamicServicePath, DynamicServiceMethod, DynamicContextKey, and DynamicControlID properties of PopupControlExtender and it will fetch dynamic content before it's shown.

Thanks,
Ted

Dynamic Collapsible Panels - Flicker and slow load

Hello,

I have a User Control that dynamically creates several collapsible panels depending on records read from sql db. The panels are created okay, but the page loads slow and flickers several times. It partially loads, displays first panel very quickly and goes blank until all other panels are created and data is loaded. It looks awfull!!

Is there a way to improve the UI?, so the page shows all panels when loaded. It would be good also showing a "wait for a moment" message when creating many panels. What is the best way to do it?

Thank you,

Carlos Lozano

Any one?

Any comments would be helpfull. Thank you.Carlos


I can't help with your issues, but could you show me how you create dynamic panels based on SQL data? Once I get it working, I will discuss with others around here to determine if there is a solution.


Mine works without the flickering. I don't use a code behind in the control that buildds it.


Try to set in web.config <compilation debug="false">

It will improve some performance.


Below is the main code that creates the panel.

Notes:

1) CustomPanel is a customization of Panel class.

2) sNewEndingID is a counter to identify each panel and its controls.

3) TableUtil.AddTableRow function basically adds the <tr><td>controls here</td></tr> to the panel to organize the panel presentation.

4) oOptions.getOptionData("Inspection") Pulls data from SQL DB to populate some of the control options (ie. DropdownList, etc).

-- Code --

public void createInspectorPanel(ref CustomPanel oParentPanel, string sNewEndingID)
{
OptionsObject oOptions = new OptionsObject();
//oParentPanel.Visible = false;

AjaxControlToolkit.CollapsiblePanelExtender oExPanel = new AjaxControlToolkit.CollapsiblePanelExtender();
CustomPanel oPanel = new CustomPanel();
oPanel.ID = "InspectorItem" + sNewEndingID;
if (oParentPanel.Controls.IndexOf(oPanel) == -1)
{
oExPanel.ID = "InspectorPanelExtender" + sNewEndingID;
oExPanel.TargetControlID = "InspectorPanel" + sNewEndingID;
oExPanel.ExpandControlID = "InspectorPanelHeader" + sNewEndingID;
oExPanel.CollapseControlID = "InspectorPanelHeader" + sNewEndingID;
oExPanel.Collapsed = true;
oExPanel.TextLabelID = "lblInspectorControlText" + sNewEndingID;
oExPanel.CollapsedText = sNewEndingID + ") - Click to view details ";
oExPanel.ExpandedText = sNewEndingID + ") - Click to hide details ";
oExPanel.SuppressPostBack = false;
oPanel.Controls.Add(oExPanel);

CustomPanel oPanelHeader = new CustomPanel();
oPanelHeader.ID = "InspectorPanelHeader" + sNewEndingID;
oPanelHeader.CssClass = "collapsePanelHeader";
//oPanelHeader.Width = 300;
oPanelHeader.Width = Unit.Percentage(98);

Label oCounterLabel = new Label();
oCounterLabel.ID = "lblInspectorCounter" + sNewEndingID;
oPanelHeader.Controls.Add(oCounterLabel);

Label oControlLabel = new Label();
oControlLabel.ID = "lblInspectorControlText" + sNewEndingID;
oControlLabel.CssClass = "BTextClass";
oPanelHeader.Controls.Add(oControlLabel);
oPanel.Controls.Add(oPanelHeader);

CustomPanel oDetailPanel = new CustomPanel();
oDetailPanel.ID = "InspectorPanel" + sNewEndingID;
oDetailPanel.Height = 50;
//oDetailPanel.Width = 350;
oDetailPanel.Width = Unit.Percentage(98);

HtmlTable oTable = new HtmlTable();
TableUtil.AddTableRow(ref oTable, 1, "InspectorName", "Name: ", 1, sNewEndingID);
TableUtil.AddTableRow(ref oTable, 2, "CompanyName", "Company: ", 1, sNewEndingID);
DropDownList MPICertLevel = new DropDownList();
TableUtil.AddTableRow(ref oTable, ref MPICertLevel, ";1;2;3", "MPICertLevel", "MPI Cert. Level: ", sNewEndingID);
DropDownList LPCertLevel = new DropDownList();
TableUtil.AddTableRow(ref oTable, ref LPCertLevel, ";1;2;3", "LPCertLevel", "LP Cert. Level: ", sNewEndingID);
DropDownList EMICertLevel = new DropDownList();
TableUtil.AddTableRow(ref oTable, ref EMICertLevel, ";1;2;3", "EMICertLevel", "EMI Cert. Level: ", sNewEndingID);
DropDownList UTCertLevel = new DropDownList();
TableUtil.AddTableRow(ref oTable, ref UTCertLevel, ";1;2;3", "UTCertLevel", "UT Cert. Level: ", sNewEndingID);
//DropDownList Inspection = new DropDownList();
ListBox Inspection = new ListBox();
Inspection.DataTextField = "Description";
Inspection.DataValueField = "Id";
Inspection.DataSource = oOptions.getOptionData("Inspection");
Inspection.Rows = 6;
Inspection.SelectionMode = ListSelectionMode.Multiple;
Inspection.DataBind();
TableUtil.AddTableRow(ref oTable, ref Inspection, "Inspection", "Inspections Done: ", sNewEndingID);
DropDownList TxtPerformance = new DropDownList();
TxtPerformance.DataTextField = "Description";
TxtPerformance.DataValueField = "Id";
TxtPerformance.DataSource = oOptions.getOptionData("InspPerformance");
TxtPerformance.DataBind();
TableUtil.AddTableRow(ref oTable, ref TxtPerformance, "Performance", "Performance: ", sNewEndingID);
TableUtil.AddTableRow(ref oTable, 9, "InspDiscrepancies", "Discrepancies: ", 2, sNewEndingID, 40);

oDetailPanel.Controls.Add(oTable);
oPanel.Controls.Add(oDetailPanel);
oParentPanel.Controls.Add(oPanel);
//oParentPanel.Visible = true;
}
}


Did you set your Content Panel's height to 0px. I'm not sure if I'm reading this correctly but I seeoDetailPanel.Height = 50;Maybe try setting that to 0 and see if that helps with the flickering.

Monday, March 26, 2012

Dynamic Ajax Content rendering in a div tag

Hi All,

I had a requirement like, where i will do asynchrounous get of data, and load the data say 10 records in a div tag. if user scroll through the div and reaches teh end of the div tag, i will remove all conents from div and load fresh contents from 11-20 in div. Like this it goes...

Now my problem,

Step 1:- 1-10 records show in div (now user scroll to end of div)

Step 2:- Remove 1-10 records show 11-20 records in div. My Question is if user wants to see 1-10 records back, i am not able to take the user to the top since the first record is at the top of the div. I can't fire any event here.

Can anyone help on this?

Thanks in advance,

Karthikeyan.

Can you poste some code? I get the idea but I want to see what even handler you are using to track the scrolling in conjunction with the records being scrolled. Perhaps also you might want to use hidden fields that put the value of the previous set of pages (in your case 1-10).


Hi,

Thank you for your post!

I suggest you keep 20 records in the div, and just display half of them.

Then, when you want get the pre 10 records, just do it like you get the next 10 Records because you can fire some events of the scroll.

If you have further questions,let me know.

Best Regards,

dynamic addhandler not working in update panel

hi all,

i have designed a page, with a place holder in it, the placeholder is inside a updatepanel, the placeholder gets filled with images at load, and when i click the viewcart button it get filled with the image information with few dynamic buttons, i have added addhandler for those buttons, but they are not firring up. i am pasting my code here if some one can help me plz.

Dim

updateorderlnkbtn AsNew button ' this is done at the genearal section of the page to make it globalAddHandler updateorderlnkbtn.click,AddressOf cancelBtn_click ' at page init

please help me

hi all

i have done some other changes to the code but still the same problem, if any one of you can give me some idea that would be highly appreciated

thanks


hi all

I have done some thing here that my 5 static buttons that are created at runtime are working fine now but the problem is with the dynamic table, i am placing a delete button in the dynamic table now the dynamic table is created at runtime and i want the delete button to remove the row.

the other buttons (5 buttons) code is something like this , i have wrote the code behing the load, the problem is that i can't wrote the dynamic table code behind the load, the dynammic table is created when i click a viewcart button

please help

Dynamic Accordion with Paging

hi there; using asp.net 2.0 (vb) i've just created a page that, in the page load event, retreives a number of records from the database.

as each record is read into a dataset, a new accordon panel is created. the panel header displays the fldName and the panel content displays the fldContent from the table.

this all works great. the issue i'm having is that it currently displays all the records (approx 200) and i only want 10 records displayed at a time.

my question is, is there somehow a way to implement paging? i found the following article:

http://rolf-cerff.de/blogs/dotnet/archive/2007/03/08/ajax-control-toolkit-paging-with-databound-accordion-control.aspx

but i'm not familiar enough with C# to understand.

also, any idea if paging for the accordion is in the works?

thanks all.

You can use a paged data source...

Basically, create a datatable from your recordset, and then...
Dim pds As New PagedDataSource
pds.DataSource = (whatever then dataset is called).Tables(0).DefaultView
pds.AllowPaging = True
pds.PageSize = 10
pds.CurrentPageIndex = curpage (passed into the databind sub, optional value that = 0 at first)
CurrentPage (see below) = pds.CurrentPageIndex + 1

What I do is to create a viewstate item called CurrentPage to keep track of the pages...
Public Property CurrentPage() As Integer
Get
Dim o As Object = Me.ViewState.Item("_CurrentPage")
If o Is Nothing Then
Return 0
Else
Return o
End If
End Get
Set(ByVal value As Integer)
Me.ViewState.Item("_CurrentPage") = value
End Set
End Property

You can then have linkbuttons to guide through pages... Just rebind using your sub and pass in CurrentPage as the curpage to advance or CurrentPage - 1 to go back.

Saturday, March 24, 2012

DropShadow Resize problem with the Shadow remaining on table resize.

The code below is just a sample I added to the DropShadow and I pretty sure this is a bug.

What happens when load up is fine. When you move items from the left listbox to the right listbox it seems fine.

EXCEPT, when one listbox becomes empty, the listbox shrinks, hence the table shrinks and then your left with this big black shadow on the right that goes up to the table. That is the shadow has not resized with the table.

If I addWidth="100%" to the Panel yes it works but then my screen design is not what I want I have this massive table on the screen. It's the solution I'm forced to use now.

<divclass="demoarea">

<divclass="demoheading">DropShadow Demonstration</div><asp:PanelID="Panel1"runat="server"CssClass="dropShadowPanel"Width="100%"><divstyle="padding:10px">

<tableborder="2"width="100%">

<tr>

<tdcolspan="3"align=center> </td>

</

tr>

<

tr><td>

<asp:ListBoxRows="20"SelectionMode="Multiple"ID="lbListLeft"runat="server"><asp:ListItem>Somewhere RSL Club, 555 Something St, Somewhere</asp:ListItem><asp:ListItem>20</asp:ListItem>

<asp:ListItem>D</asp:ListItem></asp:ListBox><br/></td><td><NOBR><inputvalue="Add >>" type="button"BR></NOBR><NOBR><inputvalue="Add <<" type="button"BR></NOBR><NOBR><inputvalue="Add All >>" type="button"BR></NOBR><NOBR><inputvalue="Add All <<" type="button"BR></NOBR></td><td>

<br/><asp:ListBoxRows="20"SelectionMode="Multiple"ID="lbListRight"runat="server"><asp:ListItem> RSL Club, 154 Somewhere Pde, Somewhere</asp:ListItem><asp:ListItem>2</asp:ListItem><asp:ListItem>3</asp:ListItem>

</asp:ListBox></td>

</

tr>

</

table>

Did you set "TrackPosition='true'" on the DropShadowProperties?


Yes I haveTrackPosition="true"as it came from the example.

Here's the complete code in a master page. YOu'll notice that once you move all items to one listbox the table shrinks I have mentioned. I've done some slight changing to the html but this content page should work standalone. Unless you tweak the Content Placer then you'll have to tweak the javascript.

<%

@.PageLanguage="C#"MasterPageFile="~/Site.master"AutoEventWireup="true"CodeFile="DropShadow.aspx.cs"Inherits="DropShadow_DropShadow"Title="DropShadow Sample" %>

<%

@.RegisterAssembly="AtlasControlToolkit"Namespace="AtlasControlToolkit"TagPrefix="atlasToolkit" %>

<

asp:ContentID="Content1"ContentPlaceHolderID="MiddleContent"Runat="Server"><atlas:ScriptManagerid="ScriptManager"EnablePartialRendering="true"runat="Server"/><divclass="demoarea"><asp:PanelID="Panel1"runat="server"CssClass="dropShadowPanel"><divstyle="padding:10px">

<

tableborder="0"width="100%">

<tr><td><tableborder=0width="100%">

<tr><tdalign="right"><asp:ListBoxRows="20"SelectionMode="Multiple"ID="lbListLeft"runat="server"><asp:ListItem>Kogarah RSL Club, 254 Railway Pde, Kogarah</asp:ListItem><asp:ListItem>20</asp:ListItem><asp:ListItem>30</asp:ListItem><asp:ListItem>40</asp:ListItem><asp:ListItem>A</asp:ListItem><asp:ListItem>B</asp:ListItem><asp:ListItem>C</asp:ListItem><asp:ListItem>D</asp:ListItem></asp:ListBox></td></tr></table><br/><br/></td><td><NOBR><inputvalue="Add >>"onclick="moveDualList( this.form.ctl00$MiddleContent$lbListLeft, this.form.ctl00$MiddleContent$lbListRight, false );"type="button"style="width:90"><BR></NOBR><NOBR><inputvalue="Add <<"onclick="moveDualList( this.form.ctl00$MiddleContent$lbListRight, this.form.ctl00$MiddleContent$lbListLeft, false );"type="button"style="width:90"><BR></NOBR><NOBR><inputvalue="Add All >>"onclick="moveDualList( this.form.ctl00$MiddleContent$lbListLeft, this.form.ctl00$MiddleContent$lbListRight, true );"type="button"style="width:90"><BR></NOBR><NOBR><inputvalue="Add All <<"onclick="moveDualList( this.form.ctl00$MiddleContent$lbListRight, this.form.ctl00$MiddleContent$lbListLeft, true );"type="button"style="width:90"><BR></NOBR></td><td>

<br/>

<br/><asp:ListBoxRows="20"SelectionMode="Multiple"ID="lbListRight"runat="server"><asp:ListItem> RSL Club, 154 Railway Pde, Kogarah</asp:ListItem><asp:ListItem>2</asp:ListItem><asp:ListItem>3</asp:ListItem><asp:ListItem>4</asp:ListItem><asp:ListItem>5</asp:ListItem><asp:ListItem>D</asp:ListItem><asp:ListItem>G</asp:ListItem><asp:ListItem>K</asp:ListItem><asp:ListItem>Z</asp:ListItem><asp:ListItem>55</asp:ListItem></asp:ListBox></td>

</

tr>

<

tr><tdcolspan=3align=center><asp:ButtonID="btnSave"Text="Save"runat=server/></td></tr>

<

tr><tdcolspan=3>

</

td></tr>

</

table>

<

br/><br/><hr/><p><asp:PanelID="CollapseHeader"runat="server"style="cursor: pointer;"width="100%"><asp:LabelID="Label1"runat="server"Text="Label">Show Details...</asp:Label></asp:Panel><asp:PanelID="Panel2"runat="server"style="overflow:hidden;height:0"width="100%">

Not many details here. This is just a demo to show how the DropShadow will react properly to changes in the size of the panel it is attached to.

</asp:Panel><atlasToolkit:CollapsiblePanelExtenderID="cpe1"runat="server"><atlasToolkit:CollapsiblePanelPropertiesTargetControlID="Panel2"Collapsed="true"CollapsedText="Show Details..."ExpandedText="Hide Details"TextLabelID="Label1"ExpandControlID="CollapseHeader"CollapseControlID="CollapseHeader"SuppressPostBack="true"/></atlasToolkit:CollapsiblePanelExtender></p></div></asp:Panel><divclass="demobottom"></div></div><atlasToolkit:DropShadowExtenderID="dse"runat="server"><atlasToolkit:DropShadowPropertiesTargetControlID="Panel1"Width="5"Rounded='true'Opacity=".75"TrackPosition="true"ID="dsBehavior"/></atlasToolkit:DropShadowExtender>

<

SCRIPTLANGUAGE="JavaScript">

<!-- Begin

// Compare two options within a list by VALUES

function

compareOptionValues(a, b)

{

// Radix 10: for numeric values, Radix 36: for alphanumeric valuesvar sA = parseInt( a.value, 36 );var sB = parseInt( b.value, 36 );return sA - sB;

}

// Compare two options within a list by TEXT

function

compareOptionText(a, b)

{

// Radix 10: for numeric values, Radix 36: for alphanumeric valuesvar sA = parseInt( a.text, 36 );var sB = parseInt( b.text, 36 );return sA - sB;

}

// Dual list move function

function

moveDualList( srcList, destList, moveAll )

{

// Do nothing if nothing is selectedif (( srcList.selectedIndex == -1 ) && ( moveAll ==false ))

{

return;

}

newDestList =

new Array( destList.options.length );var len = 0;for( len = 0; len < destList.options.length; len++ )

{

if ( destList.options[ len ] !=null )

{

newDestList[ len ] =

new Option( destList.options[ len ].text, destList.options[ len ].value, destList.options[ len ].defaultSelected, destList.options[ len ].selected );

}

}

for(var i = 0; i < srcList.options.length; i++ )

{

if ( srcList.options[i] !=null && ( srcList.options[i].selected ==true || moveAll ) )

{

// Statements to perform if option is selected, Incorporate into new list

newDestList[ len ] =

new Option( srcList.options[i].text, srcList.options[i].value, srcList.options[i].defaultSelected, srcList.options[i].selected );

len++;

}

}

// Sort out the new destination list

newDestList.sort( compareOptionValues );

// BY VALUES//newDestList.sort( compareOptionText ); // BY TEXT// Populate the destination with the items from the new arrayfor (var j = 0; j < newDestList.length; j++ )

{

if ( newDestList[ j ] !=null ) destList.options[ j ] = newDestList[ j ];

}

// Erase source list selected elementsfor(var i = srcList.options.length - 1; i >= 0; i-- )

{

if ( srcList.options[i] !=null && ( srcList.options[i].selected ==true || moveAll ) )

{

// Erase Source//srcList.options[i].value = ""; srcList.options[i].text = "";

srcList.options[i] =

null;

}

}

}

// End -->

</

script>

</asp:Content>

DropDownList Progress Bar - Very Large amount of data

I was wondering how to go about simulating a quick load of a page with AJAX. It takes 10 seconds to populate a huge dropdownlist (large size required). So I have a page that is blank for 10 seconds before showing any activity. The dropdownlist is populated using a code behind procedure calling an SQL 2005 DB SP.

Is it possible to load the page then fill the dropdown list with a progress indicator. (Or just an overall page loading indicator) I'd really appreciate any ideas or examples as I'm a wee bit mentally fatigued tonight :/. Thanks in advanced!

You can use?an asp:UpdatePanel?with?an?asp:UpdateProgress?to?load?data?from?database?and?fill?in?the?asp:DropDownList.
Here?are?some?sample?codes?for?your?reference.
<asp:UpdateProgress ID="UpdateProgress1" Visible="true" DisplayAfter="1" runat="server" AssociatedUpdatePanelID="udpUpperRight">
<ProgressTemplate>
????Loading...
</ProgressTemplate>
</asp:UpdateProgress
<table width="100%">
<tr>
<td valign="top">
<asp:PlaceHolder ID="pnlUpperLeft" runat="server"></asp:PlaceHolder>
</td>
<td style="width: 8px"></td>
<td>
<asp:UpdatePanel ID="udpUpperRight" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:Label ID="lblDisply" runat="server" Text="This is asp:UpdateProgress testing"></asp:Label>
<br />
<asp:Image ID="img" runat="server" ImageUrl="~/images/Amazon.gif" />
<asp:Button ID="btnUpdate" runat="server" Text="Update Progress" OnClick="btnUpdate_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table
Behind Code:
protected void btnUpdate_Click(object sender, EventArgs e)
{
????//Load data from database and fill out the asp:DropDownList
}

Wish?the?above?can?help?you.

Cool thanks Ji!

You've certainly opened up my eyes to more features of the update panel. Cheers!

I'm guessing I should substitute in a dropdown where the image is. Is there a way perform the button click coded behind at load? Either way I will experiment. Thanks for the help.

dropdownlist in updatepanel1 to update updatepanel2

I have 2 ddl in an updatepanel1 and when one is selected, panel refreshes to load ddl #2 based on ddl1 choice. Works great, love it. Now can ddl2 change cause updatepanel2 to refresh?doh! nevermind... set update to conditional and call updatepanel.update from codebehind.