Showing posts with label master. Show all posts
Showing posts with label master. Show all posts

Wednesday, March 28, 2012

Link Click refresh effect?

I got a master page and 2 content page.

the menu links are on the left content page.

How can i get refresh effect on the right content page when i click on the links on the left page?

http://code.google.com/webtoolkit/documentation/examples/kitchensink/demo.htmlHi,

one approach is to use theUpdatePaneltogether with theMultiViewcontrol.
Thanks very much,i got it.
sorry, can i get that kind of effect just click a link on the page without MultView?

eg. i put a link on the left content page. the right content page will refresh when i click the link?

Hi Joytony,

When you click the link, do you want to display a totally new page?? could you post the code you use for the links?

Greetings,

Dennis


Thanks Dennis,

This is the demo i did.

1 master page contain 2 links on it.
while i have 2 content page

~/Default2.aspx
~/Default3.aspx
How can i get the refresh effect in this model?
<%@. Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">Untitled Page"server"> "form1" runat="server"> "scriptmanager1" EnablePartialRendering="true" runat="Server" /> "up1" runat="server">

"HyperLink1" runat="server" NavigateUrl="~/Default2.aspx">HyperLink "HyperLink2" runat="server" NavigateUrl="~/Default3.aspx">HyperLink

"ContentPlaceHolder1" runat="server">

"Progress" runat="server"> Loading...

sorry, put the code again.
<form id="form1" runat="server"> <atlas:ScriptManager ID="scriptmanager1" EnablePartialRendering="true" runat="Server" /> <atlas:UpdatePanel ID="up1" runat="server"> <ContentTemplate> <div> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Default2.aspx">HyperLink</asp:HyperLink> <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/Default3.aspx">HyperLink</asp:HyperLink> <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton> <asp:LinkButton ID="LinkButton2" runat="server">LinkButton</asp:LinkButton> </div> <div> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </ContentTemplate> </atlas:UpdatePanel> <atlas:UpdateProgress ID="Progress" runat="server"> <ProgressTemplate> Loading... </ProgressTemplate> </atlas:UpdateProgress> </form>

Hi JoyTony,

I don't think that its possible to open a new page in another frame without a full postback. (If this is want you want to achieve). I think that Atlas is useful when you want parts of a webpage to be updated not whole pages. I think that the suggestion above with the multiview is the only option. Is there a reason that you don't want to use multiview??

Greetings,

Dennis


Hi Again,

What is the reason that you put your buttons in the update panel? These controls shoudn't be updated right?

Regards


Hmm, it seems you're kinda misusing the concept., although I do see what you're trying to do i think. If I'm not mistaken you're trying to only get the non master portion to refresh, similar to what one would achieve using frames? If so, other than the fact that it's probably not going to work, your pages will not be picked up by search engines, which is really bad unless its an intranet site.

It would be real nice if ATLAS did solve the problem of same masterpage markup being sent back with every page though, but i guess with a well designed site that should be very minimal.

Nick


Thanks Dennis andnicksh.

The reason why i don't want to use multiple view is i've done many pages there.

I just leave it there at the moment untill we really want to change. Thanks.

Linkbutton in asp:reapeater - all in user control, needs to register linkbuttons with ajax

I have a master page with the ajax script manager on it.

the master page then has a user control, which contains an asp:repeater which renders asp:LinkButtons on the page, i need them to be registered with the script manager so that they will only cause page re-renering in the content.

The problem i am facing is getting access to the ScriptManager in the master page fron theRepeater1_ItemCommand event in the user control.

Any thoughts, THanks

To programmatically access the scriptmanager:

Dim sm as ScriptManager
sm = ScriptManager.GetCurrent(Page)

LinkButton/DataGrid/HoverMenu Issue - Linkbutton not passing values?

Hello all,
I have a unique situation here, that I have been stumped on for 3 days now. I have a nested master/detail form as seen below, and within the 2nd grid I have an AJAX hovermenu, for some reason I am not able to collect the values of the form when the user wants to insert the values. I am able to capture the linkbutton event in the code behind but, when it gets to the assigning of the textbox value for entry into the DB it is comes up with a reference not set to the instance of an object. The first set of code is the asp.net page the second set is the code behind, any pointers on this would be extremely helpful, and I would owe you like lunch or something :) Thanks again for all of your help.

ASP.Net Code

1<asp:UpdatePanel ID="up0" runat="server" Visible="true">2 <ContentTemplate>3 <asp:GridView4 ID="GridView1"5 runat="server"6 Width="656px"7 CellPadding="4"8 DataSourceID="SqlDataSource1"9 ForeColor="#333333"10 OnRowDataBound="bindMarketControl"11 AutoGenerateColumns="False"12 GridLines="None"13 >14 <Columns>15 <asp:TemplateField>16 <ItemTemplate>17 <h2><%# Eval("MarketName")%></h2>18 <table width="100%">19 <tr>20 <td width="200px">Team Name</td>21 <td width="200px">Head Count</td>22 <td width="200px">Orders</td>23 <td width="200px">Revenue</td>24 </tr>25 </table>26 <asp:UpdatePanel ID="up1" runat="server">27 <ContentTemplate>28 <asp:GridView29 ID="TeamDetail"30 DataSourceID="GetTeamDetailFormView"31 AutoGenerateColumns="False"32 ShowHeader="False"33 GridLines="None"34 runat="server">35 <Columns>36 <asp:TemplateField>3738 <ItemTemplate>39 <asp:Panel CssClass="popupMenu" ID="PopupMenu" runat="server">40 <div style="border:1px outset white;padding:2px;">41 <div><asp:LinkButton42 ID="LinkButton1"43 runat="server"44 CommandName="Edit"45 Text="Edit"46 /></div>47 <div><asp:LinkButton48 ID="LinkButton2"49 runat="server"50 CommandName="Delete"51 Text="Delete" /></div>52 </div>53 </asp:Panel>54 <asp:Panel ID="Panel9" runat="server">55 <table width="100%">56 <tr>57 <td width="195px">58 <asp:Label59 Font-Bold="true"60 ID="Label0"61 runat="server"62 Text='<%# Eval("TeamName")%>' />63 </td>64 <td width="200px">65 <asp:Label66 ID="Label1"67 runat="server"68 Text='<%# Eval("HeadCount")%>' />69 </td>70 <td width="200px">71 <asp:Label72 ID="Label2"73 runat="server"74 Text='<%# Eval("Orders")%>' />75 </td>76 <td width="200px">77 <asp:Label78 ID="Label3"79 runat="server"80 Text='<%# Eval("Revenue")%>' />81 </td>82 </tr>83 </table>84 </asp:Panel>85 <cc1:HoverMenuExtender ID="hme2"86 HoverCssClass="popupHover"87 PopupControlID="PopupMenu"88 PopupPosition="Left"89 TargetControlID="Panel9"90 PopDelay="25"91 runat="server" />92 </ItemTemplate>93 <EditItemTemplate>94 <asp:Panel ID="Panel9" runat="server" Width="100%">95 <table width="100%">96 <tr>97 <td width="200px">98 <asp:TextBox99 ID="TextBox00"100 runat="server"101 Text='<%# Bind("TeamId")%>'102 Visible="false"103 EnableViewState="true"104 />105 <asp:TextBox106 ReadOnly="true"107 Font-Bold="true"108 ID="TextBox0"109 runat="server"110 Text='<%# Bind("TeamName")%>'111 EnableViewState="true" />112 </td>113 <td width="200px">114 <asp:TextBox115 ID="TextBox1"116 runat="server"117 Text='<%# Bind("HeadCount")%>'118 EnableViewState="true" />119 </td>120 <td width="200px">121 <asp:TextBox122 ID="TextBox2"123 runat="server"124 Text='<%# Bind("Orders")%>'125 EnableViewState="true"126 />127 </td>128 <td width="200px">129 <asp:TextBox130 ID="TextBox3"131 runat="server"132 Text='<%# Bind("Revenue")%>'133 EnableViewState="true" />134 </td>135 </tr>136 </table>137 </asp:Panel>138 <cc1:HoverMenuExtender139 ID="hme1"140 TargetControlID="Panel9"141 PopupControlID="PopupMenu"142 HoverCssClass="popupHover"143 PopupPosition="Right"144 runat="server">145 </cc1:HoverMenuExtender>146 <asp:Panel ID="PopupMenu" runat="server" CssClass="popupMenu">147 <div style="border:1px outset white">148 <div>149 <asp:LinkButton150 ID="lbtnInsertUpdate"151 runat="server"152 CausesValidation="True"153 CommandName="Insert"154 Text="Insert"155 OnClick="lbtnInsertUpdate_Click"156 />157 </div>158 <div>159 <asp:LinkButton160 ID="LinkButton2"161 runat="server"162 CausesValidation="False"163 CommandName="Cancel"164 Text="Cancel" /></div>165 </div>166 </asp:Panel>167 </EditItemTemplate>168 </asp:TemplateField>169 </Columns>170 </asp:GridView>171 </ContentTemplate>172 </asp:UpdatePanel>173 <asp:SqlDataSource174 ID="GetTeamDetailFormView"175 runat="server"176 ConnectionString="<%$ ConnectionStrings:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%>"177 SelectCommand="sp_GetTeamDetails"178 SelectCommandType="StoredProcedure"179 InsertCommand="sp_InsertDataInfo"180 InsertCommandType="StoredProcedure">181 <SelectParameters>182 <asp:Parameter Name="MarketID" />183 <asp:ControlParameter184 ControlID="ddlVPInfo"185 DefaultValue=""186 Name="vpid"187 PropertyName="SelectedValue"188 Type="Int32" />189 </SelectParameters>190 <InsertParameters>191 <asp:Parameter Name="TeamID" />192 <asp:Parameter Name="HeadCount" />193 <asp:Parameter Name="Orders" />194 <asp:Parameter Name="Revenue" />195 <asp:ControlParameter196 ControlID="tbEntryDat"197 Name="DataDate"198 PropertyName="Text"199 Type="String" />200 </InsertParameters>201 </asp:SqlDataSource>202 <hr />203 </ItemTemplate>204 </asp:TemplateField>205 </Columns>206 </asp:GridView>207208 <asp:SqlDataSource209 ID="SqlDataSource1"210 runat="server"211 ConnectionString="<%$ ConnectionStrings:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%>"212 SelectCommand="sp_GetMarketCats"213 SelectCommandType="StoredProcedure">214 <SelectParameters>215 <asp:ControlParameter216 ControlID="ddlVPInfo"217 DefaultValue=""218 Name="vpid"219 PropertyName="SelectedValue"220 Type="Int32" />221 </SelectParameters>222 </asp:SqlDataSource>223224 </ContentTemplate>225 <Triggers>226 <asp:AsyncPostBackTrigger227 ControlID="btnDisplayEntry"228 EventName="Click" />229 </Triggers>230 </asp:UpdatePanel>

The Code Behind

1Protected Sub lbtnInsertUpdate_Click(ByVal senderAs Object,ByVal eAs EventArgs)2Dim TeamInfoDBConnAs New SqlConnection(ConfigurationManager.ConnectionStrings("XXXXXXXXXXXXXXXXX").ConnectionString)3Dim sqlStringAs String ="sp_InsertDataInfo"4Dim sqlCmdAs New SqlCommand(sqlString, TeamInfoDBConn)5 sqlCmd.CommandType = CommandType.StoredProcedure67'Dim NewText As String =8 'Dim val1 As TextBox = CType(e.Item.FindControl("TextBox3"), TextBox)9 'MsgBox(val1.Text)101112 sqlCmd.Parameters.AddWithValue("@dotnet.itags.org.TeamID", TextBox00.Text)13 sqlCmd.Parameters.AddWithValue("@dotnet.itags.org.HeadCount", TextBox1.Text)14 sqlCmd.Parameters.AddWithValue("@dotnet.itags.org.Orders", TextBox2.Text)15 sqlCmd.Parameters.AddWithValue("@dotnet.itags.org.Revenue", TextBox3.Text)16 sqlCmd.Parameters.AddWithValue("@dotnet.itags.org.DataDate", tbEntryDate.Text)1718 TeamInfoDBConn.Open()19 sqlCmd.ExecuteNonQuery()20 TeamInfoDBConn.Close()21 sqlCmd =Nothing22 End Sub

Bump...Still looking for anyone that might have some idea about this one?? thank-you!

Saturday, March 24, 2012

Load different content pages in content place holder without refreshing the whole page usi

Hi,

I have built a ajax enabled website, where i have a master page which holds a content placeholder, and two content pages, where one is the home screen and another is a dashboard, a menu is placed in master page , by default home page is made to display, when the menu item dashboard is clicked , the the contentplace holder should load the dashboard page without postbacking the whole page, how to do that through ajax? Pleas help me.....

Its very urgent, I am stucked.....

hello.

i'd say that you cannot do that in your scenario. i'd refactor the site and transform the contents of the main page and the other page in user controls. then, i'd build only one page set its content to one of the user controls...


Luis Abreu:

hello.

i'd say that you cannot do that in your scenario. i'd refactor the site and transform the contents of the main page and the other page in user controls. then, i'd build only one page set its content to one of the user controls...

Hi Luis,

I am new in creating webapplication. I am not able to get what u'r saying.

Plese explin me in details, What is usercontrol ? How does it satisfy my needs?

Please help me. Give me an example, whre they have used user control .....

Thanks in advance


here's an old post that shows how you might change the user controls on an udpate panel:

http://msmvps.com/blogs/luisabreu/archive/2007/02/15/adding-controls-to-an-updatepanel-through-code.aspx

regarding the user control part, well, it's really the easiest way you have to develop a control. i think that if you go to the asp.net site, you'll be able to get lot of info from the quick starts

Wednesday, March 21, 2012

Loading external .aspx file into AJAX Toolkit TabPanel

Hello,

I'm new to ASP.NET AJAX. I want to create a default page, maybe a master page. then i want to add the AJAX Toolkit TabContainer with different TabPanels for each of my other .aspx files (home.aspx, about.aspx, etc.) I want to know how I would setup the TabContainer with a tabpanel for each page and load those pages when the appropriate Tab is clicked. a small snippet of example code would be greatly appreciated

Thanks to all in advance

GL

How about something like this?

<ajaxToolkit:TabContainer ID="tabs" runat="server" Width="600px" Height="400px">
<ajaxToolkit:TabPanel ID="tabHome" runat="server" HeaderText="Home">
<ContentTemplate>
<iframe src="http://pics.10026.com/?src=home.aspx" width="100%" height="100%">
</iframe>
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabAbout" runat="server" HeaderText="About">
<ContentTemplate>
<iframe src="http://pics.10026.com/?src=about.aspx" width="100%" height="100%">
</iframe>
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>


Thanksctafield, that did the trick. works like a charm but I wonder if there might be another way besides frames. I dont like to use frames plus i'm concerned about browsers that may not support frames. Thank you for the quick response

If there is another way I would greatly appreciate the guide

Thanks

GL


Ok, When I used the iframe my pages end up having 2 separate vertical scrollbars. one for the main window and one for the iframe region. i cna see that confusing my users when they need to scroll up or down. has anyone thought of another solution?

you can actually turn off the scrollbars for the iframe - just make sure you set its width and height to 100% so data doesn't get chopped and that would get rid of the scrollbar for the iframe...

<

iframeid="TargetPane"scrolling="no"


Hi,

You might also be interested in reading one of Scott Guthrie'sblog posts where he created a class called ViewManager to render ASP.NET controls to HTML and send it via a webservice to the page.

Thanks,
Ted


You can add WebControls (.ascx) to each panel you want by using following code-behind:

AjaxControlToolkit.TabPanel tpHome = new AjaxControlToolkit.TabPanel();
tpHome.HeaderText = "Home";
tpHome.ContentTemplate = Page.LoadTemplate("Home.ascx");
tcDefault.Tabs.Add(tpHome);

AjaxControlToolkit.TabPanel tpAbout = new AjaxControlToolkit.TabPanel();
tpAbout.HeaderText = "About";
tpAbout.ContentTemplate = Page.LoadTemplate("About.ascx");
tcDefault.Tabs.Add(tpAbout);

tcDefault is TabContainer control.


AjaxControlToolkit.TabPanel tab = new AjaxControlToolkit.TabPanel();
tab.HeaderText = "test_new_tab";
TabContainer1.Tabs.Add(tab);

??index error WHY?

Good piece of code to use the control on the code behind.
Even the control toolkit samples didn't have these in detail

However i couldn't load an external page onto the page.loadtemplate method
It throws the following error when trying with full path


Exception Details:System.Web.HttpException: 'http://localhost:8080/Documents/9245/bjk49000.PDF' is not a valid virtual path.

Any suggestions?

Rain Man


At the moment i'm using the following method by coding on the client end

<ajaxToolkit:TabPanel runat="server" ID="TabPanelAttachment" HeaderText="Attachments">
<ContentTemplate>
<iframe runat="server" id="iframePreview" width="850" height="800" frameborder ="0"> </iframe>
</ContentTemplate>
</ajaxToolkit:TabPanel
var urlPrefix = "http://localhost:8080/Documents/"
var urlSuffix = docId + "/" + fileName;
var url = urlPrefix + urlSuffix;

$find('TabContainerDocument').set_activeTabIndex(1);
document.getElementById('TabContainerDocument_TabPanelAttachment_iframePreview').src = url;

TabContainerDocument_TabPanelAttachment_iframePreview is the iframe id at run time
Hope that helps for someone who is trying on something similar

Happy coding

Rain Man


This reallyhas to be built into the TabPanel tool.


Haven't tried this but it might be another alternative to controls and iFrames...

Dynamic drive website has example of using Javascript to do page calls to a div, not too sure if will work in but might be good for a try?

http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

Dave

Loading UserControls in Tabs

Hello folks,

In my project I am using the AjaxToolKit to display Tabs on my page which is inherieted from a master page Script manager and UpdatePanel is on master page. The aspx page has TabContainer:

<ajaxToolkit:TabContainerID="tcMain"runat="server"OnClientActiveTabChanged="ActiveTabChanged"OnActiveTabChanged="ActiveTabChangedServer">

Also on the aspx page I have this to wireup the client side Tab change event:

<scripttype="text/javascript"language="javascript">
function ActiveTabChanged(sender, e) {
__doPostBack('<%= tcMain.ClientID %>', sender.get_activeTab().get_headerText());
}
</script>

On the code behind of the aspx page I have a method that does the work when the active Tab is changed:

protectedvoid ActiveTabChangedServer(object sender,EventArgs e){
// Do something
}

My Tab container has two tabs each of which loads a User control. What I am noticing is that whenever I switch tabs the previously loaded control has to load again, a postback is occuring. The Tab Panel in the container has ViewState enabled.

Should I have to load the UserConrol again when I switch to a different Tab?

Is there a more efficient way of doing this?

Should I unload the UserControl for better performance and making page lighter when switching tabs? Is this the correct way of doing things?

Appreciate your help.

You could put the tab panel inside of an updatepanel.
You could also set up an handler to check each time the tab is changed and load the last control from viewstate (I like to set up a property that saves any control that I load dynamically into viewstate so I can always refer to it when I need it)...


Take the update panel out of the masterpage and put on the page with the tab container.

Update panels are not intended for masterpages.

Hope this helps

DK


Hi,

You have to load the UserControl again. This is a FAQ about dynamic control in asp.net. Please refer to the following explanation.

1. Why do I have to recreate dynamic controls every time? /Why dynamic controls are disappeared on PostBack?

Whenever a request comes, a new instance of the page that isbeing requested is created to serve the request even it's a PostBack. Allcontrols on the page are reinitialized, and there state can be restored fromthe ViewState in a later phase.
The dynamic controls have to be recreated again and added tothe control hierarchy. Otherwise, they won't exist in the page.
Please be careful with when to create dynamic controls. Inorder to keep their state, they have to be created before the LoadViewStatephase. Page_Init as well as Page_Load methods are options available.
For more information about this topic, please refer to thisarticle:
Creating Dynamic Data Entry User Interfaces[http://msdn2.microsoft.com/en-us/library/aa479330.aspx ]

Hope this helps.