ラベル code の投稿を表示しています。 すべての投稿を表示
ラベル code の投稿を表示しています。 すべての投稿を表示

2012年3月28日水曜日

ResizableControlExtender Handle Click Event

I would like to be able to fire the event that occurs when the user clicks on the handle

ResizableControlExtender from my own javascript code.

Do you know how to do this?

Your help is much appreciated.

Thak you very much

Hi,

Internally, this extender doesn't support such behavior.

You may add an resizebegin event handler to the extender, in this handler, call a asynchronous method to invoke to method on server side( web service or pageMethod ) .

So, you code may goes like this:

function pageLoad()

{

var re = $find("behaviorID of the resizableExtender");

re.add_resizebegin(onResizeBegin);

}

function onResizeBegin()

{

//invoke a service side method here.

}

Hope this helps.

ResizableControlExtender and a MultiLine textbox

Can anyone give me the code for a resizableControlExtender that is used with a multiline textbox?
I don't know if it's because my brain hurts (more than usual) or what but I just can't get it to work.

Thanks!

Please refer to: http://forums.asp.net/t/1194380.aspx

ResizableControlBehavior sizing to 0 in initialize, why?

This line is in the ResizableControlBehavior.initialize code:

this._resizeControl(0, 0, 0, 0);

Why? It makes me do fancy things in my resize handler to avoid this call, but I'm wondering if I'm missing some intended logic here.

Any thoughts on this? It breaks the resize control in IE for divs that use CSS to get width.
It sets up the internal state and fires the initial resizing event. Why is this a problem?
In IE with a textarea that is set to width: 100% in the CSS, this results in a 0 size text area.
Have you tried nesting the TEXTAREA in a DIV similar to how the sample page does with the image example (which has width=100%, height=100%)?

Resized image wont show in UpdatePanel

Hello,

I have a problem with a code where I want to resize an image in a Update Panel but when I fire up my site, I get this error in a message box:

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

Details: Error parsing near '???JFIF'.

This is the code of the aspx page where the subs are called to resize and show the image (The formview is in a UpdatePanel):

1 <asp:FormView ID="DetailsFormView" runat="server" DataSourceID="DetailsFormSource">
2 <ItemTemplate>
3 <table style="vertical-align: top; text-align: left; width: 100%;">
4 <tr>
5 <td style="width: 150px; font-weight: bold;">
6 Initials:</td>
7 <td style="width: 278px">
8 <asp:Label ID="InitialerLabel" runat="server" Text='<%# Bind("Initialer")%>'></asp:Label></td>
9 <td rowspan="14" style="width: 188px">
10<%
11 ' make sure Nothing has gone to the client
12 Response.Clear()
13
14
15 If SearchGridView.SelectedValue = "" Then
16
17 Call sendError()
18
19 Else
20 If File.Exists(Server.MapPath("images/foto/" & SearchGridView.SelectedValue & ".jpg")) Then
21 Call sendFile()
22 Else
23 Call sendError()
24 End If
25
26 End If
27
28 Response.End()
29%>30 <asp:Image ID="EmpImg" runat="server" />
31 </td>
32 </tr>
33 <tr>
34 <td style="width: 150px; font-weight: bold;">
35 Full Name:</td>
36 <td style="width: 278px">
37 <asp:Label ID="FornavnLabel" runat="server" Text='<%# Bind("Fornavn")%>'></asp:Label>
38 <asp:Label ID="EfternavnLabel" runat="server" Text='<%# Bind("Efternavn")%>'></asp:Label></td>
39 </tr>
40 <tr>
41 <td style="width: 150px; font-weight: bold;">
42 Employee Nr.:
43 </td>
44 <td style="width: 278px">
45 <asp:Label ID="MedarbnrLabel" runat="server" Text='<%# Bind("Medarbnr")%>'></asp:Label></td>
46 </tr>
47 <tr>
48 <td style="width: 150px; font-weight: bold;">
49 Department code:</td>
50 <td style="width: 278px">
51 <asp:Label ID="afdelingskodeLabel" runat="server" Text='<%# Bind("afdelingskode")%>'>
52 </asp:Label></td>
53 </tr>
54 <tr>
55 <td style="width: 150px; font-weight: bold;">
56 Private address:</td>
57 <td style="width: 278px">
58 <asp:Label ID="padresseLabel" runat="server" Text='<%# Bind("padresse")%>'></asp:Label>,
59 <asp:Label ID="ppostnrLabel" runat="server" Text='<%# Bind("ppostnr")%>'></asp:Label>
60 <asp:Label ID="Bynavn" runat="server" Text='<%# Bind("Bynavn")%>'></asp:Label></td>
61 </tr>
62 <tr>
63 <td style="width: 150px; font-weight: bold;">
64 Private phone:</td>
65 <td style="width: 278px">
66 <asp:Label ID="ptelefonLabel" runat="server" Text='<%# Bind("ptelefon")%>'></asp:Label></td>
67 </tr>
68 <tr>
69 <td style="width: 150px; font-weight: bold;">
70 Private cellphone:</td>
71 <td style="width: 278px">
72 <asp:Label ID="pmobilLabel" runat="server" Text='<%# Bind("pmobil")%>'></asp:Label></td>
73 </tr>
74 <tr>
75 <td style="width: 150px; font-weight: bold;">
76 Phone:</td>
77 <td style="width: 278px">
78 <asp:Label ID="telefonLabel" runat="server" Text='<%# Bind("telefon")%>'></asp:Label></td>
79 </tr>
80 <tr>
81 <td style="width: 150px; font-weight: bold;">
82 Cellphone / Shortnr:</td>
83 <td style="width: 278px">
84 <asp:Label ID="mobil1Label" runat="server" Text='<%# Bind("mobil1")%>'></asp:Label>
85 /
86 <asp:Label ID="mobil2Label" runat="server" Text='<%# Bind("mobil2")%>'></asp:Label></td>
87 </tr>
88 <tr>
89 <td style="width: 150px; font-weight: bold;">
90 Mail address:
91 </td>
92 <td style="width: 278px">
93 <asp:Label ID="mailLabel" runat="server" Text='<%# Bind("mail")%>'></asp:Label>@dotnet.itags.org.***.com</td>
94 </tr>
95 <tr>
96 <td style="width: 150px; font-weight: bold;">
97 Private mail:</td>
98 <td style="width: 278px">
99 <asp:Label ID="pmailLabel" runat="server" Text='<%# Bind("pmail")%>'></asp:Label></td>
100 </tr>
101 <tr>
102 <td style="width: 150px; font-weight: bold;">
103 Based:
104 </td>
105 <td style="width: 278px">
106 <asp:Label ID="hjemh?rendeLabel" runat="server" Text='<%# Bind("hjemh?rende")%>'>
107 </asp:Label></td>
108 </tr>
109 <tr>
110 <td style="width: 150px; font-weight: bold;">
111 Position:</td>
112 <td style="width: 278px">
113 <asp:Label ID="StillingLabel" runat="server" Text='<%# Bind("Stilling")%>'></asp:Label></td>
114 </tr>
115 <tr>
116 <td style="width: 150px; font-weight: bold;">
117 Vehicle nr.:</td>
118 <td style="width: 278px">
119 <asp:Label ID="vognnrLabel" runat="server" Text='<%# Bind("vognnr")%>'></asp:Label></td>
120 </tr>
121 </table>
122 </ItemTemplate>
123 </asp:FormView>
124

And this are the subs that is resizing the image:

 
1Function NewthumbSize(ByVal currentwidth,ByVal currentheight)
234' Calculate the Size of the New image56Dim tempMultiplierAs Double
78 If currentheight > currentwidthThen' portrait9 tempMultiplier = 200 / currentheight
10Else11 tempMultiplier = 200 / currentwidth
12End If
131415 Dim NewSizeAs New Size(CInt(currentwidth * tempMultiplier),CInt(currentheight * tempMultiplier))
1617Return NewSize
18End Function
192021 Public Sub sendFile()
2223' create New image and bitmap objects. Load the image file and put into a resized bitmap.24Dim gAs System.Drawing.Image = System.Drawing.Image.FromFile(Server.MapPath("images/foto/" & SearchGridView.SelectedValue &".jpg"))
25Dim thisFormat = g.RawFormat
2627Dim thumbSizeAs New Size
28 thumbSize = NewthumbSize(g.Width, g.Height)
2930Dim imgOutputAs New Bitmap(g, thumbSize.Width, thumbSize.Height)
3132' Set the contenttype3334 Response.ContentType ="image/jpeg"353637 imgOutput.Save(Response.OutputStream, thisFormat)' output to the user
3839 ' tidy up40 g.Dispose()
41 imgOutput.Dispose()
4243End Sub
4445 Public Sub sendError()
4647' if no height, width, src then output "error"48Dim imgOutputAs New Bitmap(120, 120, PixelFormat.Format24bppRgb)
49Dim gAs Graphics = Graphics.FromImage(imgOutput)' create a New graphic object from the above bmp50 g.Clear(Color.Yellow)' blank the image51 g.DrawString("ERROR!",New Font("verdana", 14, FontStyle.Bold), SystemBrushes.WindowText,New PointF(2, 2))
52' Set the contenttype53 Response.ContentType ="image/gif"5455' send the resized image to the viewer56 imgOutput.Save(Response.OutputStream, ImageFormat.Gif)' output to the user
5758 ' tidy up59 g.Dispose()
60 imgOutput.Dispose()
61End Sub

I search a bit on the the what the problem could be, and I didn't find enything than that Response.Write can't be used, but I didn't hear nothing about the others Response methods that I am using.

You can't inject that type of data into the response stream of a partial postback. It boils down to the exact same problem as using Response.Write.

If I were you, I'd change that to a regular image control with the ImageURL dynamically assigned through code similar to what you have. If the thumbnail already exists, your function can return the path/file to it. If not, it creates the thumbnail and then returns the path/file. If there's an error, it can return the path/file of that error GIF.


Hmm.. I thought about your idea but I don't want to have the images two times.

But I got the problem solved.

I made an file called Thumbnail.aspx and in it I wrote:

<%@. Page Language="VB" AutoEventWireup="false" CodeFile="Thumbnail.aspx.vb" Inherits="Thumbnail" ContentType="image/jpeg" %>

And in Tumbmail.aspx.vb I added this code:

Imports System
Imports System.IO
Imports System.Drawing
Imports System.Drawing.Imaging
PartialClass Thumbnail
Inherits System.Web.UI.Page

Private PathToImageAs String ="images/foto/"Sub sendFile()
' create New image and bitmap objects. Load the image file and put into a resized bitmap.Dim gAs System.Drawing.Image = System.Drawing.Image.FromFile(Server.MapPath(PathToImage & Request("src")))
Dim thisFormat = g.RawFormat
Dim imgOutputAs New Bitmap(g, 177, 239)

' Set the contenttype Response.ContentType ="image/jpeg"' send the resized image to the viewer imgOutput.Save(Response.OutputStream, thisFormat)' output to the user

' tidy up g.Dispose() imgOutput.Dispose()End Sub

Sub sendError()

' create New image and bitmap objects. Load the image file and put into a resized bitmap.Dim gAs System.Drawing.Image = System.Drawing.Image.FromFile(Server.MapPath("images/noimage.jpg"))
Dim thisFormat = g.RawFormat
Dim imgOutputAs New Bitmap(g, 177, 239)

' Set the contenttype Response.ContentType ="image/jpeg"' send the resized image to the viewer imgOutput.Save(Response.OutputStream, thisFormat)' output to the user

' tidy up g.Dispose() imgOutput.Dispose()End Sub

Protected Sub Page_Load(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Me.Load

' make sure Nothing has gone to the client Response.clear()If Request("src") ="" Then
Call sendError()

Else

If File.Exists(Server.MapPath("PathToImage & Request("src")))Then
Call sendFile()
Else
Call sendError()
End If

End If response.end()End Sub
End Class

And in my formview I added this to display the image:

<img src="http://pics.10026.com/?src=Thumbnail.aspx?src=<%# SearchGridView.SelectedValue %>.jpg" alt="" style="border: 0px" />

That works for me,

Response.Redirect

This is the code to redirect to a new page from a GridView...

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string SeqNo = "";
string dd = "";
int ix = GridView1.SelectedIndex;

if (ix >= 0)
{
SeqNo = GridView1.SelectedRow.Cells[4].Text;
dd = GridView1.SelectedRow.Cells[1].Text;
if ( (SeqNo.Trim() != "") && (dd.Trim() != "") )
Response.Redirect(String.Format("DocketOnline.aspx?DocketDate={0}&SeqNo={1}&cn={2}", dd, SeqNo, FCaseNo));
}
}

Prior to placing the GridView in an UpdatePanel, the code above worked fine. Now clicking on the Select column, triggering the code above, gives the error:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

How do I fix this?

All I want is to have GridView in an UpdatePanel so that paging is AJAXed...I also want the user to be able to select a command column to go to another page.

Thanks,

Jay

You would either have to:

1. on the RowDataBound register javascript to open a new window for the selected row event...

or

2. Just use a link button and set the url and targetpane properties in a column to open a new window or to navigate to the new page.

or - cancel the asynchpost prior to the redirect and then redirect (not sure this one will work though)...

Using the response.rediect in asynch the ScriptManger gets involved and things just get messy...because it intercepts everything and the response.redirect messes up the expected structure it is figuring on sending to the client for the partial page update..


Hi,

I have a user control which does not have script manager. In this user controll I input zipcode and it will populate the city state. This user control in on the main page along with other user controls. Script manager is on the main page. There is no script manager proxy. When I click on the button to populate the city state info it is populating it but whole page is refreshed instead of city and state which is inside the update panal. Does anyone have any idea whats causing this issue?

Regards,
Nepalaya


Response.Redirect should work fine during an async postback.

Response.redirect - display text in same page.

Hi guys,

I am using A.aspx , B.aspx and C.aspx pages.

From A.aspx I am calling b.aspx via Ajax code. After (Check Login user from database) success status , I am tryint o redirecting to C.aspx. But

C. aspx page content is dispalying in A.aspx. It suppose to be redirec to C.aspx. What I am dong wrong here..??

any suggessions ??

hello.

well, i'mo not following you. can you be more specific?


I am trying to check the Loginuser permissions from the Database. Once he get success permission the page has to redirect to new page.
here is my Code.

Login.aspx (a.aspx) - Enter user id & pwd and click Submit then below code executes


function CheckUser()
{
if (preLoginCheck())
{ var url = serverName+"checkLogUser.aspx?userID="+ document.frmDefault.txtUid.value +"&Pwd="+ document.frmDefault.txtPwd.value;
xmlHttp = GetXmlHttpObject(ChangeHandler);
xmlHttp_Get(xmlHttp, url);
}
}


function ChangeHandler()
{ if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
{ var getData=xmlHttp.responseText;
if (getData=="Success")
{ document.getElementById("ErrorCode").innerText=" GoooooooooooooooD";
}
else
{
document.getElementById("ErrorCode").innerText=getData; //" Invalid User name /Password";
}
}
}

checkLogUser.aspx (b.aspx) - Ajax will execute this page from here itself I want to redirec to Third Page..


If (tmpUserID <> "" And tmpUserPwd <> "") Then
crapObj = New CRAPManagement
getLogInStatus = crapObj.checkLoginUserAccess(tmpUserID, tmpUserPwd)
If getLogInStatus = "Success" Then
Response.Redirect("UserCreate.aspx") --> C.Aspx
Else
Response.Write(getLogInStatus)
End If
End If

Finanl result is C.Aspx page content is displaed in Login.aspx Page.


hello.

well, if you're using asp.net 2.0, then check the authenticationservice class:

http://www.asp.net/ajax/documentation/live/ClientReference/Sys.Services/AuthenticationServiceClass/default.aspx


Hello,
I could't understand wha should I do exactly...!


hello.

well, instead of writing your own code for making the remote call and then having to build your page on the server that has server logic for authenticating a user, you'll get that for free with the service i've showed you in the previous post (it'll authenticate by using forms authentication and it'll automatically use the current defined membership provider you've set up on the server side).

Response.Redirect and AsyncPostBackTrigger

I've got a "Previous" button on a webform that uses this code to take user to previous page:

Response.Redirect(Session.Item("PREVIOUSPAGE"))

I set the button as an AsyncPostBackTrigger. This error occurs when the button is clicked:

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

If I change the button from AsyncPostBackTrigger to PostBackTrigger, it works fine.

Why won't this button work asynchronously? I've got 2 other buttons on the same page that are being used as AsyncPostBackTriggers with no issue.


I think it would not work because asynchronously - the Ajax enviroment is just expecting to work with the session variables of the current page, but you are trying to tell it to revert back to previous session ids with a redirect. A postback will work because it reloads or mimics a back button of the browser. Not saying it is not possible - I am wrong plenty of times - but it would make sense that that would be the behavior. You'll also get the same behavior if a session times out and the user tries to do a back button to a previous ajax enabled page.

What I would at least consider a better solution is leverage the ability with Ajax to load and unload controls dynamically. This way you can have 'paging' and still retain the benefits of the asyncrhonous enviroment.


There is an article on how to achieve that in the Scott Guthrie's blog:


http://weblogs.asp.net/scottgu/archive/2007/02/06/asp-net-ajax-goodies-documentation-download-back-button-support-new-animation-control.aspx

Juan

2012年3月26日月曜日

Response.Redirect doesnt work when the button is inside an ajax updatepanel

Hello,

I am getting the following error whenever I click a button inside an ajax updatepanel and it tries to Response.Redirect from the code behind.

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

Details: Error parsing near'

<!DOCTYPE html P'

I wasn't sure if it was my page not being correct or if it was something else. So I created two basic test pages test.aspx and test2.aspx. I click a button on text.aspx and it is supose to redirect to test2.aspx. This is a basic example giving the exact same error. So hopefully if I can get a resolution to this I could fix my real asp.net page. Thanks, Risso

Here is the test.aspx code:

<%

@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="test.aspx.cs"Inherits="test" %>

<%

@dotnet.itags.org.RegisterAssembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"Namespace="System.Web.UI"TagPrefix="asp" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server"><linkhref="css/modaldialog.css"rel="stylesheet"type="text/css"/><title>Untitled Page</title>

</

head>

<

body><formid="form1"runat="server"><div><asp:ScriptManagerID="ScriptManager1"runat="server" ></asp:ScriptManager><asp:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><asp:ButtonID="Button1"runat="server"OnClick="Button1_Click2"Text="Button"/></ContentTemplate></asp:UpdatePanel></div></form>

</

body>

</

html>

HERE IS the Code behind code:

using

System;

using

System.Data;

using

System.Configuration;

using

System.Collections;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Web.UI.HtmlControls;

public

partialclasstest : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

}

protectedvoid Button1_Click2(object sender,EventArgs e)

{

Response.Redirect(

"~/test2.aspx");

}

}

HI.

Try to useServer.Transfer.


I did server.transfer shown below. It still gives the same error message. I put a breakpoint in the test2.aspx to see if it makes it to that pages_load event and it does, but the browser throws the exact same error message as listed in the first post. Any other ideas?

protectedvoid Button1_Click2(object sender,EventArgs e)

{

Server.Transfer("~/test2.aspx");

}


Hi, u must knwo that Response.Redirect and Server.Transfer work inside UpdatePanel.

can u share us the detail of the error that u have.


I tried your code and one of my own and it appears to be fine. Before you start beatin your head against the wall, try this...

This a must read from Eilon Lipton's Technical blog on Microsoft ASP.NET and ASP.NET AJAX when trying to solve PageRequestManagerParserErrorException errors!

http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx?CommentPosted=true#commentmessage A


Eilon Lipton's tips are great, I just add some more: Test "test2.aspx" for any invalid html markup, also test the response with fiddler.

Ok,

I found out were it is happening, but now I am not sure how to solve it since what I have to remove is also needed. I found that it was inside the web.config. I'm adding 2 httphandlers that were needed to fix other AJAX issues. I don't recall exactly what those issues were because this is a big application and it was a while back. I do remember these were needed to fix other ajax problems though. I do not want to remove these and have them break other ajax controls/tools. Anyone know a work around for this. I do know now that these httpHandlers are what is causing my Response.Redirect() issue in my updatepanel.

I removed the following lines from my web.config for it to work.

<

httpHandlers>

<

removeverb="*"path="*.asmx"/>

<

addverb="*"path="*.asmx"validate="false"type="Microsoft.Web.Services.ScriptHandlerFactory, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<

addverb="GET,HEAD"path="ScriptResource.axd"type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"validate="false"/>

</

httpHandlers>

Risso


Shoot, I just realized those were needed for the Ajax to work in IE. And by me removing those lines from the web.config it just does a normal postback and not an asynchronous call. That is why it worked for me. So really nothing has changed. I am back to nothing on why the response.redirect() doesn't work. You guys mentioned that you took the code and were able to get the response.redirect() to work. I'm not sure what in my environment could be any different. I'm running this off of localhost and I do not have IIS running.

Yeah. Have you tried a new website as ajax supported web? I tried both an iis and casini version of the test. What version of vs are you running?


Aesop:

Yeah. Have you tried a new website as ajax supported web? I tried both an iis and casini version of the test. What version of vs are you running?

Agree, use vs to create a new "ASP.NET Ajax-Enabled Web Site" or "ASP.NET Ajax CTP-Enabled Web Site", and use the web.config of the new site as a template, so carefully migrateyourweb.config into the template.

You can get a template web.config also from a similar path:

C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025

C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Futures January CTP\v1.0.61025


Yes, I got it to work!! Thank you for your persistent responses. I did what you both recommended and started a new Ajax Application and pulled its web.config to compare to mine and went line by line with testing each line and found what I was missing. My web.config didn't have

<

httpModules>

<

addname="ScriptModule"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</

httpModules>

Risso


Hi Rissoman,

Thanks your post. I have the problem like you. I took 2 days to find why I always take the PageRequestManagerParserErrorException. Well, I am upgrading the website, and missing the <httpModules>

Thanks again,

HUH


Thanks to everyone who posted about this. You've just saved me a lot of time and effort! Thanks!


HI,

Thanks a ton .for that code..

regards

Delia Joe

retrieve info dynamically created textbox in update panel

I have a textbox that is created in code in an Ajax Update Panel when then the user clicks on a dropdownlist.

I would then like to retreive the text that user types in:

Dim strTitleAsString =CType(Me.FindControl("txtPrimaryPersonTitle" + intSuggestedPrimaryPersonCount.ToString), TextBox).Text

It gives me an error that it can't find the control.

Can you offer any help??

Have you made sure that the textbox is re-created on postback?

You may also consider creating the textbox statically (in markup) instead of dynamically.
Set Visible=False in the markup, and make it visible in your dropdownlist code.
This prevents most of the problems inherent to dynamic controls.

Jos


hello.

how about a demo page so that we can see what you're doing? it has to be simple enough so that we ca simply copy/paste it in order to test it


Hi,

it can't find the control?

If the contorl still exist, the Id must not write.

I think it is easy to debug to see if the contorl is exist or not, and it is easy to find out what is the correct id of the contorl.

If you still have question,post up a repro of your issue.

Best Regards,

2012年3月24日土曜日

Reusable CalendarExtender example with code provided...Enjoy!

I wanted to figure out a way to have a single calendarExtender per page that I could use on any Date Field whether it be a startDate and an endDate or some customer date records in a repeater. Basically I didn't want to have a million CalendarExtenders on the page, so I decided to set out on an adventure and conquer the unknown!!...Well, 4 days later and with less hair on my head I have figured out a really simple way to use a single ( only one ) calendarExtender per page for many different Date Fields. The best part is that there is no need to modify the Ajax Control Toolkit framework!

I have provided a simple example of only 1 startDate and 1 endDate, but really you could have as many startDates and endDates as you desire. Please contact me if you have any questions or problems implementing it.

Enjoy,

Greg Benoit (Benwah)

--
GregBenoit.com
PrecisionSoftware.Net
StaffKeeper.com

<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title> A single CalendarExtender for multiple date fields </title> <script type="text/javascript"> /* Author: Greg Benoit (Benwah) Last Modified: 3/16/2007 This is an example of using a single CalendarExtender DatePicker is MS Ajax for an unlimited number of date field text boxes. This is a simple example, but could easily be extended into a more robust solution of having a single CalendarExtedner within a repeater. */ function pageLoad() { // the ensureCalendar must be called in the pageLoad to hookup the PopupBehavior $find('popupCalBhvr')._ensureCalendar(); } /* Given an element (el) and an event (ev) this method fires a javascript function attached to the element...such as onclick, onfocus, onchange etc... */ function FireEvent(el, ev) { if (document.createEventObject) { el.fireEvent(ev); } else if (document.createEvent) { var localE = document.createEvent("HTMLEvents"); localE.initEvent(ev.substring(2, ev.length), true, true); el.dispatchEvent(localE); } } /* Takes the Date value in the txtHidden field and sees if it is different from the one already in the parentElement. If they are different, then change the value of the parentElement to reflect the new date and fire the onchange event of the parent. */ function UpdateClientDate(cal) { var parentDateElement = $find('popupCalBhvr')._popupBehavior.get_parentElement(); var hiddenTxtBox = $get('txtHidden'); // the ID could be ctl00_txtHidden if you're using master pages if(parentDateElement.value != hiddenTxtBox.value) { parentDateElement.value = hiddenTxtBox.value; FireEvent(parentDateElement, 'onchange'); } } /* */ function ShowPopupCalendar(calPopupTarget) { $find('popupCalBhvr').hide(); // hide the calendar if it already showing // set the parentElement of the CalendarPopup behavior...this is what the calendar will popup under. $find('popupCalBhvr')._popupBehavior.set_parentElement(calPopupTarget); var hiddenTxtBox = $get('txtHidden'); // the ID could be ctl00_txtHidden if you're using master pages var theDate = new Date(calPopupTarget.value); // figure out what date is selected...default is today if(isNaN(theDate)) { // Set the currently selected date to today's date b/c no date exists // in the parentElement right now. $find('popupCalBhvr').set_selectedDate(new Date()); hiddenTxtBox.value = ''; } else { // Set the currently selected date to that date that already exists in the // parentElement. $find('popupCalBhvr').set_selectedDate(theDate); hiddenTxtBox.value = calPopupTarget.value; } // fire the onfocus event of the hiddentTextBox to make the Calendar popup. FireEvent(hiddenTxtBox, 'onfocus'); } /* Both of these function are just functions I made up to show how to handle the selection of a new date...The functions would typically have some sort of key passed into them so you know what record to update in the DB. */ function UpdateStartDate(txtStartDate) { alert('Here you would send the new start date ('+txtStartDate.value+') to the server via WebService'); } function UpdateEndDate(txtEndDate) { alert('Here you would send the new end date ('+txtEndDate.value+') to the server via WebService'); } /* HTML Notes: Notice the txtStartDate and txtEndDate values can either be set to a date or be blank */ </script></head><body> <form id="form1" runat="server"> <ajax:ScriptManager ID="ScriptManager1" runat="server"> </ajax:ScriptManager> <table> <tr> <td> Start Date: </td> <td> End Date: </td> </tr> <tr> <td> <input id="txtStartDate" value="3/1/2007" onclick="ShowPopupCalendar(this);" readonly="readonly" onchange="UpdateStartDate(this);" type="text" /> </td> <td> <input id="txtEndDate" value="" onclick="ShowPopupCalendar(this);" readonly="readonly" onchange="UpdateEndDate(this);" type="text" /> </td> </tr> </table> <asp:TextBox ID="txtHidden" style="z-index: 1001; position: absolute;" Width="0px" Height="0px" runat="server" BackColor="White" BorderColor="White" BorderStyle="None" BorderWidth="0px" ForeColor="White"></asp:TextBox> <ajaxToolkit:CalendarExtender ID="calPopup" runat="server" BehaviorID="popupCalBhvr" TargetControlID="txtHidden" OnClientDateSelectionChanged="UpdateClientDate" Format="MM/dd/yyyy"> </ajaxToolkit:CalendarExtender> </form></body></html>

One more thing...Remember you can style the CalendarExtender anyway you desire using the css classes of the Calendar found herehttp://community.bennettadelson.com/blogs/rbuckton/archive/2007/02/02/Skinning-model-for-Calendar-and-Tabs-in-Ajax-Control-Toolkit.aspx


Hot Tip man, thanks for sharing it with us :?)

I'm making a slight alteration to allow for the calendar to be aligned specifiacally for a control as i have some date fields at the top of the page and some at the bottom and sometimes i want eh calendar postioned over the top of the control as opposed to the bottom

I really do like this solution though man

cheers

Tim



The only problem i'm having is setting the date correctly on subsequent calls

I'm in the UK and we use the dd/MM/yyyy format on the CalendarExtender. All is well until I go to repopulate the date. JavaScript uses MM/dd/yyyy and suddently 04/10/2007 from the hiddenbox becomes 10/04/2007 and i get the SelectedDate as October 4th 2007

I'm wondering if we could do something clever by determining the Format property of the calendar and moving the parts around to suit

just a thought


Just in case anyone's interested, here is the code to covnert the date back to a JavaScript date is you are using a special dateformat, as opposed to mm/dd/yyyy

theDate = GetFormattedDate(calPopupTarget.value,$find('popupCalBhvr')._format);

should be used to collect the date, and this function is used to convert it across

function GetFormattedDate(dateString,dateFormat){ //need to split the years, months and days according to the specified string var theSecond = ""; var theMinute = ""; var theHour = ""; var theDay = ""; var theMonth = ""; var theYear = ""; for(var i = 0; i < dateFormat.length ; i++) { switch(dateFormat.charAt(i)) { case "M": theMonth += dateString.charAt(i); break; case "y": theYear += dateString.charAt(i); break; case "d": theDay += dateString.charAt(i); break; } } var theReturnedDate = new Date(); theReturnedDate.setFullYear(parseInt(theYear), parseInt(theMonth) - 1, parseInt(theDay)); return theReturnedDate; }

This looks great...I am glad it is working for you and let me know if you come up with anymore fixes/updates!

Thanks for the input,

Greg


Well, i had a minor issue i just had to fix.

I couldn't get the pageLoad() method to fire on pageload but it didn't make any difference previously as the _popupBehavior object was set up by the time i called the method which hooked it all up. "No biggie" i thought and carried on anyway

However, i just upgraded to the latest AjaxToolkit and i was getting the error that "_popupBehavior is null or not an object". I still can't get the pageLoad thing to work without hooking it up via PageRequestManager.add_pageLoaded(), and even then the behavior object isn't initialised so it was kinda useless for me. I now have the _ensureCalendar() call on my ShowPopup() method but i'm not convinced this is the right place since it fires every time, not just on pageLoad

How did you get the pageLoad() method to fire your end Greg?


and now i'm convinced something has changed with this release

I'd actually used that pageLoad() method in another section which i use to populate a textbox with data from the server via a JavaScript but this is no longer firing on pageLoad() :?(


good article thanks.


I've got this is working great as long as the page does not have any vertical scrolling.

However, I'd like to use multiple CalendarExtenders going down a page that may have some scrolling.

In Firefox, If the page has vertical scrolling and a Date is clicked on the CalendarExtender, the page scrolls down to the bottom of the page, and the calendar click event doesn't seem to trigger.

In IE, it appears to operate normally.

I've created an example using the exact code provided, just duplicated so that enough instances occurr to cause the page to scroll.

Please let me know if there is a fix to this! Thanks!

Here is my example:http://test.dev.isoc.net/CalendarExtenderTest/

-John Berman


John,

I'm glad to see you're using the code... I know of this issue and it is because the hidden Text box is at the top of the page and when it gets the focus, the page automatically tries to scroll it into view. There are some work arounds, but I wanted to let you know that the link you provided above is not working...

-Greg


The link should be working now. If you know of a work around or can point me in the right direction I'd really appreciate it!


Hey,

I talked with a few friends of mine over at Microsoft (Ted Glaza and Scott Guthrie) and they advised me to submit a Bug on the CodePlex site. Please vote for our issue at the following link:

http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=12206

Also please keep that test site up there showing the problem b/c I included the link to it in my description.

Thanks,

Greg

--
GregBenoit.com
PrecisionSoftware.Net
QGenda.com
StaffKeeper.com

Hey,

Can you provide the code for placing the calender extender above the control.

I was searching on google and came to this blog but unfortunatly no solution is attached to it...


I spent a ton of time trying to track down the cause to the calendarplacement when the page has vertical scrolling. I even went as far aswriting a fix javascript function for the onShown event that called thepopupBehavior.set_y() function and passed in the value ofdocument.body.scrollTop. But then i went back to the examples andcould not understand why the examples worked but my page was notworking. After a considerabe amount of time of modifying and tweakingthe example page i found the cause for the placement issue ...

if you add

<!DOCTYPE>

tothe top of your page before the html tag then the vertical scroll is nolonger an issue for the calendar placement. I'm not sure why ...couldnt find anything that would explain it in the source but addingthat resolved my issue.

2012年3月21日水曜日

RoundedCorners not displaying vertical border

I have the following code for RoundedCorners.
<asp:Panel ID="Panel1" runat="server" Height="50px" Width="500px" >
<div style="padding:10px;text-align:center">
<div style="padding:5px; border:solid black thin;background-color:#B4B4B4;">
ggggggggggggggggggggggggggggg
</div>
</div>
</asp:Panel>
<cc1:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server">
<cc1:RoundedCornersProperties TargetControlID="Panel1" Radius=2 Color="red" />
</cc1:RoundedCornersExtender
This only shows me horizontal border but not the vertical border. It shows me top and bottom border in red. Not left and right. What am I doing wrong?I'm not exactly sure what you mean, but I think you get the borders by replacing the first div tag with:

<div style="padding:10px;text-align:center;border-left:solid 1px red;border-right:solid 1px red"
I did that. It works. Thx. However, there is a gap between bottom horizontal line and left and right vertical lines

RoundedCornersExtender and CollapsiblePanelExtender dont work together on IE7

This code works well on Firefox.

I need to create Panels that have rounded corners and that are collapsable...

on IE7 the panel flashes and does not expand.

Thanks,

Eyal

<

asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager><divid="divFiltersHeader"><asp:PanelID="pnlFiltersHeader"Width="520"Height="30"CssClass="TransHistoryFiltersHeader"runat="server"><divstyle="float: left;padding: 5px;vertical-align: middle;">Advanced Filters</div></asp:Panel></div><divid="divFilters"><asp:Panelid="pnlFilters"CssClass="TransHistoryFiltersTable"runat="server"><p>Here come the filters !!!</p><p>filter 1</p><p>filter 2</p><p>test:<asp:DropDownListID="DropDownList1"runat="server"><asp:ListItem>test1</asp:ListItem><asp:ListItem>test2</asp:ListItem><asp:ListItem>test3</asp:ListItem></asp:DropDownList></p><p>filter 4</p></asp:Panel></div><toolkit:CollapsiblePanelExtenderID="cpeFiltersPanel"runat="server"TargetControlID="pnlFilters"ExpandControlID="pnlFiltersHeader"CollapseControlID="pnlFiltersHeader"Collapsed="true"SuppressPostBack="true">

</toolkit:CollapsiblePanelExtender><toolkit:RoundedCornersExtenderID="RoundedCornersExtender1"runat="server"TargetControlID="pnlFiltersHeader"Radius="5"></toolkit:RoundedCornersExtender>

I don't know if you were able to solve this problem or not but I had the same issue and was able to get around it. It appears that when both extenders are calling the same panel, the CollapsiblePanelExtender breaks. To solve this I simply nested thepnlFiltersHeaderpanel, as you have called it inside a new panel and a div and set Corners="Top". I also nested the area that expands and collapses inside a new panel and div and set Corners="Bottom" and pointed to each with seperate RoundedCornersExtender's. This allowed me to have a title that is one color and a bottom that expands in another color, but the form looks as if it is a continuous piece.

My solution is setup as follows (To save as much space as possible I removed all of the labels and text boxes and replaced them with ".......CONTENT..........":

<script>function pageLoad() {

document.getElementById(

'panelarea').style.display ="";

}

</script><asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager>

<

asp:PanelID="Panel3"runat="server"style="width:287px"BackColor="SteelBlue"> <div>

<asp:PanelID="Panel1"runat="server"style="cursor:hand; width:287px;"BackColor="SteelBlue"Width="180px">

......CONTENT......

</asp:Panel> </div></asp:Panel><asp:PanelID="Panel4"runat="server"style="width:287;"BackColor="Gainsboro"Width="287px"> <div> <divid="panelarea"style="display: none;"> <asp:PanelID="Panel2"runat="server"style="cursor:hand; overflow:hidden;"BackColor="Gainsboro"Width="287px"Height="0"> <div> .......CONTENT.........

</div> </asp:Panel> </div> </div></asp:Panel>

<cc1:CollapsiblePanelExtenderID="CollapsiblePanelExtender1"runat="server"TargetControlID="Panel2"CollapsedSize="0"ExpandedSize="275"Collapsed="False"ExpandControlID="Panel1"CollapseControlID="Panel1"AutoCollapse="False"AutoExpand="False"ScrollContents="False"ImageControlID="Image1"ExpandedImage="~/Images/collapse.jpg"ExpandedText="Hide Details"CollapsedImage="~/Images/expand.jpg"CollapsedText="Show Details..."ExpandDirection="Vertical"SuppressPostBack="true"></cc1:CollapsiblePanelExtender>

<cc1:RoundedCornersExtenderID="RoundedCornersExtender1"runat="server"TargetControlID="Panel3"Radius="6"Corners="Top"></cc1:RoundedCornersExtender><cc1:RoundedCornersExtenderID="RoundedCornersExtender2"runat="server"TargetControlID="Panel4"Radius="6"Corners="Bottom"></cc1:RoundedCornersExtender>

RoundedCornersExtender is NOT working!

hi, For some reason, this code is no working for me:

private showImage(ArticleImage ai) {

Image i=new Image();

i.Id="pppp";

i.ImageUrl=ai.url;

MainPanel.Controls.add(i);

RoundedCornersExtender rce=new RoundedCornersExtender();

rce.id="bleble"+ai.id;

rce.TargetId=i.Id;

rce.Radius=6;

}

what I get is the image without rounded corners. why is it happens?

naor:

what I get is the image without rounded corners. why is it happens?

Hi naor,

I believe the extender is to be used with a panel.


Hi Jason, When I put the Image in a Panel, the effect was the same.

I get the Image without rounded corners.

how can I display the image with rounded corners?

can anyone give me a working example?

tnx


Here is a sample, please try it:

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void Page_Load(object sender, EventArgs e) { Image i = new Image(); Panel pl = new Panel(); PlaceHolder1.Controls.Add(pl); pl.Controls.Add(i); pl.BorderColor = System.Drawing.Color.Blue; pl.BackColor = System.Drawing.Color.Blue; pl.ID = "pnl"; i.ID = "pppp"; i.ImageUrl = "images/add.gif"; AjaxControlToolkit.RoundedCornersExtender rce = new AjaxControlToolkit.RoundedCornersExtender(); PlaceHolder1.Controls.Add(rce); rce.ID = "bleble"; rce.TargetControlID = pl.ID; rce.Radius = 6; }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> </div> </form></body></html>

Hi,

I've tried what you wrote for me. I use a but different code:

1"C#" %>23"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">45<script runat="server">67 protected void Page_Load(object sender, EventArgs e)8 {9 Image i = new Image();10 Panel pl = new Panel();11 PlaceHolder1.Controls.Add(pl);12 pl.Controls.Add(i); pl.BorderColor = System.Drawing.Color.Blue;13 pl.BackColor = System.Drawing.Color.Blue;14 pl.ID = "pnl";15 i.ID = "pppp";16 i.ImageUrl = "../images/1/1.jpg";1718 i.Height = 200;19 i.Width = 200;2021 pl.Height = 200;22 pl.Width = 200;232425 AjaxControlToolkit.RoundedCornersExtender rce = new AjaxControlToolkit.RoundedCornersExtender();26 PlaceHolder1.Controls.Add(rce);27 rce.ID = "bleble";2829 rce.TargetControlID = pl.ID;3031 rce.Radius = 6;32 }33</script>3435<html xmlns="http://www.w3.org/1999/xhtml" >36"Head1" runat="server">37383940 "form1" runat="server">41

42 "ScriptManager1" runat="server">4344 "PlaceHolder1" runat="server">45

464748

The result I got is the image inside a panel, with two blue thin rounded corners rectangles on the top of the image and on the bottom of it.

It didn't make rounded corner image. What is the problem of it?


I post my last post with errors, the changged were only on the script - and the script posted ok. the rst HTML is the same as you wrote.

RoundedCornersExtender confilicting with ModalPopupExtender in IE ?

hey every one i have the following code ... when you comment out RounedCornersExtender...the gridview dispears when the page loads

any idea why that is... only happnes in IE ..mozilla works fine :S

<%@dotnet.itags.org. Page Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Admin_Default" Title="Campaigns" %><%@dotnet.itags.org. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlastoolkit" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <atlas:ScriptManager ID="sm1" runat="server" EnablePartialRendering="True"> </atlas:ScriptManager><%-- <atlastoolkit:RoundedCornersExtender ID="rce" runat="server"> <atlastoolkit:RoundedCornersProperties TargetControlID="GV_CampaignList" Radius="8" Color="#507CD1" /> </atlastoolkit:RoundedCornersExtender>--%> <atlastoolkit:ModalPopupExtender ID="MPE" runat="server"> <atlastoolkit:ModalPopupProperties TargetControlID="insertLnkBtn" PopupControlID="insertPnl" BackgroundCssClass="modalBackground" /> </atlastoolkit:ModalPopupExtender> <div class="MessageHeader"> Campagins </div> <br /> <hr /> <div id="MainContent"> <asp:GridView ID="GV_CampaignList" runat="server" Width="400px" HorizontalAlign="Center" AllowPaging="True" AllowSorting="True" DataSourceID="DS_GetAllCampagins" CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnSelectedIndexChanging="GridView1_SelectedIndexChanging"> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="C_SiebelID" HeaderText="ID" /> <asp:BoundField DataField="C_Title" HeaderText="Name" SortExpression="C_Title" /> <asp:CommandField ShowEditButton="True" /> <asp:CheckBoxField DataField="C_isActive" HeaderText="Active" /> </Columns> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <RowStyle BackColor="#EFF3FB" /> <EditRowStyle BackColor="#2461BF" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" /> <AlternatingRowStyle BackColor="White" /> <PagerSettings Position="TopAndBottom" /> </asp:GridView> <br /> <asp:LinkButton ID="insertLnkBtn" runat="Server" OnClientClick="ShowPanel();">Create New Campaign</asp:LinkButton> <script language="javascript" type="text/javascript"> function ShowPanel(){ document.getElementById('ctl00_ContentPlaceHolder1_insertPnl').style.visibility = "visible"; } </script> </div> <br /> <asp:Panel ID="insertPnl" runat="server" CssClass="popupControl"> <asp:DetailsView ID="DetailsView1" runat="server" CssClass="DetailView" AlternatingRowStyle-CssClass="DetailViewEven" HorizontalAlign="Center" GridLines="None" DataSourceID="DS_GetAllCampagins" DefaultMode="Insert"> <Fields> <asp:CommandField ShowInsertButton="True" HeaderText="Create New Campaign" ShowHeader="True" /> </Fields> <AlternatingRowStyle CssClass="DetailViewEven" /> </asp:DetailsView> </asp:Panel> <atlas:UpdateProgress ID="updating" runat="server"> <ProgressTemplate> Updating DataBase<img src="../images/ball2.gif" height="40" width="40" /> </ProgressTemplate> </atlas:UpdateProgress> <asp:SqlDataSource ID="DS_GetAllCampagins" runat="server" CacheDuration="600" ConnectionString="<%$ ConnectionStrings:LocalSqlServer%>" SelectCommand="Campaigns_Admin_GetAll" SelectCommandType="StoredProcedure" SqlCacheDependency="Campaigns" InsertCommand="Campaigns_Admin_Insert" InsertCommandType="StoredProcedure" UpdateCommandType="StoredProcedure"> </asp:SqlDataSource></asp:Content>
The GridView disappeared because the RoundedCorners was pointing at it, a TABLE, and the way RoundedCorners works is such that pointing it at a TABLE isn't great. So I added a wrapper Panel and tweaked the settings to get things centered again. The below page works for me in IE7 and FF:
<%@. Page Language="C#" %><%@. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <atlas:ScriptManager ID="sm1" runat="server" EnablePartialRendering="True"> </atlas:ScriptManager> <atlastoolkit:RoundedCornersExtender ID="rce" runat="server"> <atlastoolkit:RoundedCornersProperties TargetControlID="Panel1" Radius="8" Color="#507CD1" /> </atlastoolkit:RoundedCornersExtender> <atlastoolkit:ModalPopupExtender ID="MPE" runat="server"> <atlastoolkit:ModalPopupProperties TargetControlID="insertLnkBtn" PopupControlID="insertPnl" BackgroundCssClass="modalBackground" /> </atlastoolkit:ModalPopupExtender> <div class="MessageHeader"> Campagins </div> <br /> <hr /> <div id="MainContent"> <asp:Panel ID="Panel1" runat="server" Width="400px" HorizontalAlign="Center" BackColor="lightblue" style="margin-left:auto;margin-right:auto;"> <asp:GridView ID="GV_CampaignList" runat="server" Width="400px" HorizontalAlign="Center" AllowPaging="True" AllowSorting="True" DataSourceID="DS_GetAllCampagins" CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False" > <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="C_SiebelID" HeaderText="ID" /> <asp:BoundField DataField="C_Title" HeaderText="Name" SortExpression="C_Title" /> <asp:CommandField ShowEditButton="True" /> <asp:CheckBoxField DataField="C_isActive" HeaderText="Active" /> </Columns> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <RowStyle BackColor="#EFF3FB" /> <EditRowStyle BackColor="#2461BF" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" /> <AlternatingRowStyle BackColor="White" /> <PagerSettings Position="TopAndBottom" /> </asp:GridView> </asp:Panel> <br /> <asp:LinkButton ID="insertLnkBtn" runat="Server" OnClientClick="ShowPanel();">Create New Campaign</asp:LinkButton> <script language="javascript" type="text/javascript"> function ShowPanel(){ document.getElementById('ctl00_ContentPlaceHolder1_insertPnl').style.visibility = "visible"; } </script> </div> <br /> <asp:Panel ID="insertPnl" runat="server" CssClass="popupControl"> <asp:DetailsView ID="DetailsView1" runat="server" CssClass="DetailView" AlternatingRowStyle-CssClass="DetailViewEven" HorizontalAlign="Center" GridLines="None" DataSourceID="DS_GetAllCampagins" DefaultMode="Insert"> <Fields> <asp:CommandField ShowInsertButton="True" HeaderText="Create New Campaign" ShowHeader="True" /> </Fields> <AlternatingRowStyle CssClass="DetailViewEven" /> </asp:DetailsView> </asp:Panel> <atlas:UpdateProgress ID="updating" runat="server"> <ProgressTemplate> Updating DataBase<img src="../images/ball2.gif" height="40" width="40" /> </ProgressTemplate> </atlas:UpdateProgress> <asp:XmlDataSource ID="DS_GetAllCampagins" runat="server"> <Data> <root> <item C_SiebelID="a" C_Title="b" C_isActive="false" /> </root> </Data> </asp:XmlDataSource> </div> </form></body></html>

Thank you very much Smile