Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all 5678 articles
Browse latest View live

How to send Model value as parameter while submitting @Ajax.Beginform()

$
0
0

Hi,

I am using @Ajax.Beginform in my View which is tightly bound to the ViewModel.

I've  @Html.ListBoxFor inside my form. I add and delete items from the listbox using jQuery. Now what I am want to achieve is that onpress of the submit button, it should send full data present in the listbox regardless of which are selected. Currently it sends the list to controller if  I select all the item in the listbox and press submit button. But I don't want to do that. Any idea as to how to achieve this?

Can it be sent as a form parameter. 

@using (Ajax.BeginForm("SaveTextComponent", "LoanFilterEditor", new{ param1 = Model.listBoxItem},  new AjaxOptions { HttpMethod = "POST", OnSuccess = "SUCCESS" }))

I try to accept the parameter in the controller like this

 public ActionResult SaveTextComponent(TextComponentViewModel model, List<SelectListItem> list)
{
}

But list is null.. Please help.


Accordion Content Clipped in iframe by Height of Shortest Pane

$
0
0

Hi,  I have reviewed all the posts having to do with my problem but have not found a resolution as  yet.

The website I have inherited has a seven-pane Accordion control that is loaded into an iframe element.  The iframe element sets the height of the accordion control dynamically with some JavaScript code that was obtained from the DynamicDrive website:  IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com).  Everything works fine with the Accordion control and its panes until a button is clicked somewhere (inside or outside of the Accordion) that causes a server post-back.  Then the height of the Accordion is clipped to whatever the height of the last pane expanded is.  Ithink it's the iframe element that is getting its scrollheight measurement from the height of whichever Accordion pane was last used and which is much shorter than the top Accordion pane (the default expanded pane on first load).  The iframe then sets the height limit for the whole Accordion control based on that, so that the content is clipped for all the panes, based on the height of the shorter panes. 

The Accordion control's property settings are as follows:

AutoSize = none (don't like scrollbars in the content panes)
RequireOpenedPane = false
SuppressHeaderPostbacks = true

I was wondering if a possible solution might be to add some code to the iframe JavaScript method that will check for a minimum scrollheight before setting the height of the iframe, so that the iframe height will beat least x pixels in height; maybe in the resizeIframe( ) function?  I'm not too strong in JavaScript so any help here would be appreciated.  Also, if there is a better solution, I am agreeable to that as well.  Setting a manual minimum height is not the best of all solutions, becuase most records viewed would probably be shorter than that and so the user would have to scroll down to see the other 6 collapsed panes.

Edit:  On further reflection, I think what I need most is to set the minimum height of the iframe to the total height of the Accordion with the first pane expanded , because that pane's content will always be the longest.  So how do I persist that value and pass it from the ASPX page where the Accordion sits to the Default.ASPX page where the iframe sits, and also to the MasterPage where the iframe's height is set in JavaScript?
End Edit

Here is the JavaScript that sets the height of the iframe element:

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
    var iframeids = ["ctl00_ContentPlaceHolder1_MainFrame"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
var ExtraHeight = 30

function resizeCaller()
{
	var dyniframe=new Array()
	for (i=0; i<iframeids.length; i++)
	{
	if (document.getElementById)
		resizeIframe(iframeids[i])
		//reveal iframe for lower end browsers? (see var above):
		if ((document.all || document.getElementById) && iframehide=="no")
		{
			var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
			tempobj.style.display="block"
		}
	}
}


function resizeIframe(frameid) {
    var currentfr = document.getElementById(frameid)
    if (currentfr) {
        currentfr.style.display = "block";
        if (currentfr.Document && currentfr.Document.body.scrollHeight) {                                                                //ie5+ syntax
            currentfr.height = currentfr.Document.body.scrollHeight;
        } else if (currentfr.contentDocument && currentfr.contentDocument.body.scrollHeight) { //ns6+ / opera syntax
            currentfr.height = currentfr.contentDocument.body.scrollHeight + FFextraHeight;
        } else if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) { //standards compliant syntax - probably nothing

            // will drop through to this
            currentfr.height = currentfr.contentDocument.body.offsetHeight + FFextraHeight;
        }
        if (currentfr.addEventListener) {
            currentfr.addEventListener("load", readjustIframe, false);
        } else if (currentfr.attachEvent) {
            currentfr.detachEvent("onload", readjustIframe);  // Bug fix line
            currentfr.attachEvent("onload", readjustIframe);
        }
    }
}

function readjustIframe(loadevt)
{
	var crossevt=(window.event)? event : loadevt
	var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
	if (iframeroot)
		resizeIframe(iframeroot.id);
}


function loadintoIframe(iframeid, url)
{
	if (document.getElementById)
	document.getElementById(iframeid).src=url
}


if (window.addEventListener)
	window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
	window.attachEvent("onload", resizeCaller)
else
    window.onload = resizeCaller
/***********************************************

* end Iframe SSI script II

/***********************************************/


thank you,

Sherry

IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)

ajax calendar extender saving only default date into DB

$
0
0

aspx

 <tr>
            <td>
                DiscoveryDate
            </td>
            <td class="style1">
                <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">  
                </asp:ToolkitScriptManager>
                <asp:TextBox ID="txtcalDiscoveryDate" runat="server"></asp:TextBox>
                <asp:Image ID="Image2" runat="server" ImageUrl="~/images/cal.png" />
                <asp:CalendarExtender ID="CalendarExtender1" TargetControlID="txtcalDiscoveryDate" Format="dd/MM/yyyy" PopupButtonID="TextBox1" PopupPosition="Right" runat="server" />
            </td>
        </tr>

cs:

protected void bnRegisterApplication_Click(object sender, EventArgs e)  {

a.DiscoveryDate = CalendarExtender1.SelectedDate.GetValueOrDefault(); }

its getting saved as 1/1/0001 12:00:00 AM in the DB even after selecting the date. I see in debugging its getting the date into a.DiscoveryDate but CalendarExtender1.SelectedDate.GetValueOrDefault() returning deafult. Shouldnt I be using the extender there?

I cant use  a.DiscoveryDate = txtcalDiscoveryDate.Text; bz the error "cant implicity convert type "string" to System.Date.Time"

Any direction where I can check.

Sys.ArgumentException: Sys.ArgumentException: Please set valid values for the height and width attributes in the slider's CSS classes Parameter name: element size

$
0
0

Hi, 

Guys I am stuck with this problem. I am creating dynamic extented sliders from code behind. And I am getting following error list, you can view it here : https://skydrive.live.com/redir?resid=4CFD9A87074E190C!1037&authkey=!AHw68oWfM08AzO4

In result of these I am unable to move the slider's handle in FireFox and Chrome but its works perfectly fine in IE and also it doesn't give errors in IE. 

This is the script that Ajax is generating: 

ys.Application.add_init(function() {
$create(Sys.Extended.UI.SliderBehavior, {"BoundControlID":"ctl00_ContentPlaceHolder1_gridRatings_ctl05_txtBoundCompetency37814","Maximum":5,"Minimum":1,"id":"ctl00_ContentPlaceHolder1_gridRatings_ctl05_seHBP37814"}, null, null, $get("ctl00_ContentPlaceHolder1_gridRatings_ctl05_txtCompetency37814"));
});

I think its thoes null values giving me error. Any help is much appriciated. 

Thanks,

Attiqe



Modalpopupextender displaying at page load

$
0
0

I am using modal popup extender, and an asp button on my webpage to display some different messages as per the loggedin user. While user click on submit the page displays a message in popup box. Simply this application is running prefectly on my development machine. But when i upload it to hosting space modalpopup displays on the page load and remains on the page.

I am sending the code which i used in application. Please help me to solve this issue.

In all cases, application is running as required and good on local machine, but raising problem on server.

For live demo of the page please visit

http://www.uttarakhandtemples.in/webform1.aspx

Thank you

Vinay KD

Webpage HTML

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="UKTemples.WebForm1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//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" >
<head runat="server">
    <title>Untitled Page</title>
    <style>
        .modalBackground                    {background-color:#3A3A3A; filter:alpha(opacity=70); opacity:0.65;}
        .pop-up-box                            {width:600px; height:280px; margin-top:50px; margin-left:50px; background-color:#fcfcfc; border:solid 2px #efefef; color:#5a5a5a; padding:15px; position:relative;}
        .pop-up-box-heading                    {background-color:#fcfcfc; height:20px; border-style:solid; border-width:0px 0px 1px 0px; padding-bottom:2px;}
        .pop-up-box-imgtd                    {width:150px; height:200px; background-color:#fcfcfc; text-align:center; vertical-align:middle;}
        .pop-up-box-messagetd                {background-color:#fcfcfc; font-size:14px; line-height:1.6; vertical-align:middle;}
        .pop-up-box-closebutton-wrapper        {position:absolute; width:30px; top:10px; right:5px;}    
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>    
        
        <asp:Button ID="Button1" runat="server" Text="Button" />
        
        <div style="height:0px;">
        <asp:Panel ID="Panel1" runat="server" class="pop-up-box">
            <table cellpadding="0px" cellspacing="10px" style="width:600px; font-family:tahoma;">
                <tr>
                    <td class="pop-up-box-heading" colspan="2">
                        Success
                    </td>
                </tr>
                <tr>
                    <td class="pop-up-box-imgtd">
                        <img src="/images/success-tick.png" style="width:120px;" />
                    </td>
                    <td class="pop-up-box-messagetd">
                        <asp:Literal ID="ltr_message" runat="server"></asp:Literal>
                    </td>
                </tr>
            </table>
            <div class="pop-up-box-closebutton-wrapper">        
                <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="/images/red-close-button-2.png" Width="30px" />
            </div>
        </asp:Panel>        
        </div>
        
        <asp:HiddenField ID="hdn_Refresh_vwstate" runat="server" />
        <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="modalBackground" PopupControlID="Panel1" cancelcontrolid="ImageButton1" targetcontrolid="ImageButton1">
        </cc1:ModalPopupExtender>
    </div>
    </form>
</body>
</html>

Server Side Code, (code behind)

Public Partial Class WebForm1
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'ModalPopupExtender1.Hide()
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        ModalPopupExtender1.Show()
    End Sub
End Class

Web.Config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>  
    <configSections>
    <!-- FOR URL REWRITER -->
    <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
    <!-- FOR URL REWRITER -->
      <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
            <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
                <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
            </sectionGroup>        
        </sectionGroup>
    </sectionGroup>
    </configSections>
    <appSettings />
    <connectionStrings>
        <add name="CONNECTION_TO_DATABASE" connectionString="server=localhost;userid=myuserid; password=secret345; database=applicationdb; pooling=false;" />
    </connectionStrings>    
    
    <system.web>
        <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions
            where data loss can occur.
            Set explicit="true" to force declaration of all variables.
        -->
        <compilation debug="true" strict="false" explicit="true">
            <assemblies>
                <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
                <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
                <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
                <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
                <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />                
            </assemblies>
        </compilation>
        <pages>
            <namespaces>
                <clear />
                <add namespace="System" />
                <add namespace="System.Collections" />
                <add namespace="System.Collections.Generic" />
                <add namespace="System.Collections.Specialized" />
                <add namespace="System.Configuration" />
                <add namespace="System.Text" />
                <add namespace="System.Text.RegularExpressions" />
                <add namespace="System.Linq" />
                <add namespace="System.Xml.Linq" />
                <add namespace="System.Web" />
                <add namespace="System.Web.Caching" />
                <add namespace="System.Web.SessionState" />
                <add namespace="System.Web.Security" />
                <add namespace="System.Web.Profile" />
                <add namespace="System.Web.UI" />
                <add namespace="System.Web.UI.WebControls" />
                <add namespace="System.Web.UI.WebControls.WebParts" />
                <add namespace="System.Web.UI.HtmlControls" />
            </namespaces>
            <controls>
                <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            </controls>
        </pages>
        <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
    <authentication mode="Windows" />
    <customErrors mode="Off" />
        <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
        <httpHandlers>
            <remove verb="*" path="*.asmx" />
            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
        </httpHandlers>
        <httpModules>
            <!-- FOR URL REWRITER -->
            <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
            <!-- FOR URL REWRITER -->
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </httpModules>
        <httpRuntime maxRequestLength="1024000" executionTimeout="3600" />
    </system.web>
 
    <system.codedom>
        <compilers>
            <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
                <providerOption name="CompilerVersion" value="v3.5" />
                <providerOption name="OptionInfer" value="true" />
                <providerOption name="WarnAsError" value="false" />
            </compiler>
        </compilers>
    </system.codedom>
    <!--
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
    <system.webServer>
    <!-- FOR URL REWRITER -->
        <modules runAllManagedModulesForAllRequests="true">
        <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
        </modules>
        <validation validateIntegratedModeConfiguration="false" />
    <!-- FOR URL REWRITER -->
    <directoryBrowse enabled="false" />
    <defaultDocument>
      <files>
        <clear />
        <add value="default-home.aspx" />
      </files>
    </defaultDocument>    
        
    </system.webServer>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
 
    <!-- FOR URL REWRITER -->
      <rewriter>
        <rewrite url="~/about us" to="~/about-us.aspx" />
        <rewrite url="~/mission" to="~/mission.aspx" />
      </rewriter>
    <!-- FOR URL REWRITER -->
 
</configuration>

RequiredFieldValidator not working when Ajax

$
0
0

I have a couple of controls on my page that when a selection is made from a drop down will either enable or disable the RequiredFieldValidator.  When I enter the screen and hit the button it displays the required text, but once I make a selection in the drop down the RequiredFieldValidator will no longer work.  Is there any issues with this? 

protected void ddlistMailLog_SelectedIndexChanged(object sender, EventArgs e)
        {
            rfvMailDate.Enabled = ddlistMailLog.SelectedValue != "NA";
            rfvMailTo.Enabled = ddlistMailLog.SelectedValue != "NA";
            MailDateSpan.Visible = ddlistMailLog.SelectedValue != "NA";
            MailToSpan.Visible = ddlistMailLog.SelectedValue != "NA";
            }        }

<tr><td><span id="MailToSpan" class="required" runat="server">*</span></td><td>
     Mail To:</td><td><asp:TextBox ID="tbMailTo" runat="server" Columns="50" MaxLength="100"></asp:TextBox><asp:RequiredFieldValidator ID="rfvMailTo" runat="server" ControlToValidate="tbMailTo"
            Enabled="True" ErrorMessage="Required" SetFocusOnError="true" ValidationGroup="Main"></asp:RequiredFieldValidator></td></tr><tr><td><span id="MailDateSpan" class="required" runat="server">*</span></td><td>
      Mail Date:</td><td><rad:RadDatePicker ID="tbMailDate" runat="server"></rad:RadDatePicker><asp:RequiredFieldValidator ID="rfvMailDate" runat="server" ControlToValidate="tbMailDate"
       Enabled="True" ErrorMessage="Required" SetFocusOnError="true" ValidationGroup="Main"></asp:RequiredFieldValidator></td></tr>



Modalpopup TargetControlID cannot find LinkButton ID which is in Gridview

$
0
0

Hi, i am a beginner at using gridviews and ajax control toolkit tools.

I am having difficulty setting the Modalpopup's TargetControlID with a LinkButton's ID which is inside a Gridview.


Error message :

The TargetControlID of 'ModalPopupExtender1' is not valid. A control with ID 'LinkButton1' could not be found.

 Source Codes : 

<asp:LinkButton ID="LinkButton1" runat="server" Text="Watch Online Now" OnClick="LinkButton1_Click"></asp:LinkButton>  (In a Gridview)

<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BehaviorID="MPE"
OkControlID="btnOkay" TargetControlID="LinkButton1" PopupControlID="Panel1" PopupDragHandleControlID="PopupHeader"
Drag="True" BackgroundCssClass="ModalPopupBG" DynamicServicePath="" Enabled="True">
</asp:ModalPopupExtender> (outside of Gridview)

AsyncFileUpload control doesn't work second time in the same session - Firefox

$
0
0

Hello,

I have one AsyncFileUpload Control on the page. with below code snippet.

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><html><head><script type="text/javascript">

        function uploadError(sender, args) {
             $get("<%=lblMesg.ClientID%>").style.color = "red";
             //$get("<%=lblMesg.ClientID%>").innerHTML = "File upload failed. Please check file format or size.";
             $get("<%=lblMesg.ClientID%>").innerHTML = args._errorMessage.toString();
        }

        function closewindow() {
        // Code to cleare the control
           var who = document.getElementById('<%= AsyncFileUpload1.UniqueID %>')[0];
            who.value = "";

            var who2 = who.cloneNode(false);
            who2.onchange = who.onchange;
            who.parentNode.replaceChild(who2, who);
           // end clear code

        $get("<%=lblMesg.ClientID%>").style.color = "green";
            $get("<%=lblMesg.ClientID%>").innerHTML = "File Uploaded Successfully";
            window.opener.location.href = "/MamberManagement/NominationVerifiedList/";
            //window.opener.location.reload(true);
            window.close();
        }</script></head><body><form id="form1" runat="server" enctype="multipart/form-data" method="post"><div id="Upload" align="center"><cc1:ToolkitScriptManager ID="ToolkitScriptManager" runat="server"></cc1:ToolkitScriptManager><table><tr><td class="style5"><label>&nbsp;</label></td><td align="left"><cc1:AsyncFileUpload OnClientUploadError="uploadError" runat="server" ID="AsyncFileUpload1"
                        Width="242px" CompleteBackColor="White" OnClientUploadComplete="closewindow"
                        UploadingBackColor="#CCFFFF" ThrobberID="imgLoader" OnUploadedComplete="FileUploadComplete"
                        UploaderStyle="Modern" />&nbsp;<asp:Image ID="imgLoader" runat="server" ImageUrl="~/Images/ColumnProgress.gif" Style="margin-bottom: 0px" /></td></tr></table></form></body></html>

It does work for the first time. But when I upload second time in the same session, it doesn't fire any event.

Anyone can help me on this?


what requirement are needed to make ajax to work

$
0
0

This is my code itz not working

<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
}
</script>
</head>
<body>

<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>

</body>
</html>

when i'm writing this code in notepad and saves with extension .html and itz working

Please  help me out and let me know sholud be done to make this code work.

HTMLEditor AutoFocus set to false not works in Chrome

$
0
0

Hi all,

In my web page, there is a textbox control followed by an html editor.

When the page loads, the focus automatically sets to html editor.

After sets AutoFocus to false, IE sets the focus to the first control.

But in Chrome and Firefox it does not work.

Thanks in advance,

Binoj KN

ModalPopupExtender shows IFrame. How to keep iframe.source/contents visible

$
0
0

I'm very new to Asp.Net. I've come across handling ModalPopupExtenders with UpdatePanels and forcing ModalPopupExtender.Show() on to keep the modal window open previously. But I've only experienced it where the contents of the model popup have been coded within the same aspx form so far.

Now Im trying to cope with a modal popup extender with an IFrame that sources/parents another form. I've worked out how to keep the modal popup showing the IFrame, but the contents of the IFrame vanish immediately the popup pops up.

Is anybody able to help please?

(I've been using Rahman Masadur's very helpful article and "Expanse example" code so far at http://www.codeproject.com/Articles/34996/ASP-NET-AJAX-Control-Toolkit-ModalPopupExtender-Co and it's confused me because although he's been using ModalPopupExtenders his code seems so clean of update panels and he's done the same as me for using a 2nd form in an IFrame but his doesn't disappear)

ModalPopupExtender disappears on specifyin TargetControlID

$
0
0

Hi All,

I have a ModalPopUPextender in my page. ALso the Popup is supposed to be a Panel which has textboxes, Labels, Dropdowns. I also have a link button which I want to use to bring up the pop up. The problem is during design time when I mention the TargetControlID of the Link button, the ModalPopUpExtender disappears from the page. Also while runtime, I can't see the Link button also.

 

Thanks in advance.

double doctype after postback

$
0
0

I have a C# asp.net 4.5 web application.  It seems like I am getting 2 doctypes in my pages.  I have been trying to find ther source for a couple months, but cannot.  My master page has one html doctype on it - <!DOCTYPE html><html lang="en">.   But what I get on my pages looks like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!DOCTYPE html PUBLIC "" ""><HTML class=" js flexbox no-flexboxlegacy canvas canvastext no-webgl no-touch geolocation postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize no-borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg no-smil svgclippaths" lang="en">

I have searched the prject for !doctype and transitional and some other phrases but I cannot find where that HTML 4.0 is coming from anywhere.  It is really driving me nuts.   Has anyone else ever had this problem?

 

Thanks,
Scott Emick
       

How to set focus to Ajax combobox

$
0
0

Hello: I have a web app with a formview control that has an ajax combobox in it:

 

<%--     AJAX COMBO BOX CONTROL:--%><asp:ComboBox ID="ddCompanyName" DropDownStyle="Simple" AutoCompleteMode="Append" runat="server" TabIndex="1"  DataSourceID="SqlDataSourceCompanyName" DataTextField="companyname" DataValueField="companynameId" SelectedValue='<%# Bind("companyname")%>'></asp:ComboBox><%--     END AJAX COMBO BOX CONTROL:--%>

I need to set the focus on this control when the page loads. I have tried to do it on the server side of my code:

 Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If Page.IsPostBack Then
        Else
           ScriptManager1.SetFocus(MainContent_frmCustomerInformation_ddCompanyName_ddCompanyName_TextBox.ClientID)
        End if
    End Sub

But it's not happy with my choice of client ids. to find what it was, I was running the page and viewing the source.

Am I on the right track here?

thank you for your help.

 

Proctor


 

       

 

           

 

 

Adding new items to the Ajax combobox control

$
0
0

Hello: I have a form that has an Ajai combobox control on it. This control, is populated by a dataset:

 

<%--     AJAX COMBO BOX CONTROL:--%><asp:ComboBox ID="ddCompanyName" DropDownStyle="Simple" AutoCompleteMode="Append" AppendDataBoundItems="true"  runat="server" TabIndex="1"  DataSourceID="SqlDataSourceCompanyName" DataTextField="companyname" DataValueField="companynameId" SelectedValue='<%# Bind("companyname")%>'><asp:ListItem Text="Select" Value="" /></asp:ComboBox><asp:RequiredFieldValidator ID="reqCompanyName" runat="server" ControlToValidate="ddCompanyName" InitialValue="" Display="None" SetFocusOnError="true" ErrorMessage="Please select or enter Customer Name." /></td><%--     END AJAX COMBO BOX CONTROL:--%>


And in addition to it being populated by a dataset, I wanted to add item "Select" so that it appears at the top of the list and displays when the page loads; In my code above, I attempted to do this by adding this line:

<asp:ListItem Text="Select" Value="" />

however, when the page loads, the combo box appears blank until you click on it; that's when you see all the values in the database and it places "Select" into the mix in alpha order.

How can I make it so that "Select" appears at the top of the items. Also, how can I make "Select" appear in the box when the page loads?

thank you for your help,

Proctor


passing null into datetime.parseexact

$
0
0

I am trying to save 4 dates into the DB after selecting from the ajax calendar control. Having problem saving some null dates into the DB.If all have dates it gets saved into db. If anydate is null I am getting error: FormatException: String was not recognized as a valid DateTime. I tried tryparse and datetime.parse too.Nothing helped. Any suggestions? I am trying to hardcode the date for a workaround in place of null like this if (txtcalEstimatedFixDate == null)  { txtcalEstimatedFixDate = 1/1/0001;  } error:Cannot implicitly convert type 'int' to 'string'   


aspx:

<tr>
            <td>
                closedDate:
            </td>
            <td>
                <asp:TextBox ID="txtcalClosedDate" runat="server"></asp:TextBox>
                 <asp:Image ID="Image2" runat="server" ImageUrl="~/images/cal.png" />
                <asp:CalendarExtender ID="CalendarExtender2" TargetControlID="txtcalClosedDate" Format="dd/MM/yyyy"  PopupButtonID="TextBox1" PopupPosition="Right" runat="server" />
            </td>
        </tr>

cs:

DateTime.ParseExact(txtcalOpenedDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture),

DateTime.ParseExact(txtcalClosedDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture)

DateTime.ParseExact(txtcalEstimatedFixDate.Text,"dd/MM/yyyy", CultureInfo.InvariantCulture),

DateTime.ParseExact(txtcalFixedDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture),    

Java script not working within ajax generated div

$
0
0

This is my main page or what you may say index.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="zain.aspx.cs" Inherits="Ajax.zain" %><!DOCTYPE html PUBLIC "-//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"><head runat="server"><title></title><!-- ajax script start --><script type="text/javascript">
        function callAJAX(url, pageElement, callMessage) {
            document.getElementById(pageElement).innerHTML = callMessage;
            try {
                req = new XMLHttpRequest(); /* e.g. Firefox */
            }
            catch (e) {
                try {
                    req = new ActiveXObject("Msxml2.XMLHTTP");
                    /* some versions IE */
                }
                catch (e) {
                    try {
                        req = new ActiveXObject("Microsoft.XMLHTTP");
                        /* some versions IE */
                    }
                    catch (E) {
                        req = false;
                    }
                }
            }



            req.onreadystatechange = function () { responseAJAX(pageElement); };
            req.open("GET", url, true);
            req.send(null);

        }


        function responseAJAX(pageElement) {
            var output = '';
            if (req.readyState == 4) {
                if (req.status == 200) {
                    output = req.responseText;
                    document.getElementById(pageElement).innerHTML = output;
                }
            }
        }
    </script><!-- ajax script end --></head><body><form id="form1" runat="server"><a href="#" onclick="callAJAX('ResultPage.aspx','AjaxData')">View Website</a><div id="AjaxData"><!-- website would be shown here --></div></form></body></html>

Now here is my result.aspx page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ResultPage.aspx.cs" Inherits="Ajax.ResultPage" %><!DOCTYPE html PUBLIC "-//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"><head runat="server"><title></title><!-- grid script start --><script type="text/javascript">$(document).ready(function () {$("#btnShowSimple").click(function (e) {
                ShowDialog(false);
                e.preventDefault();
            });$("#btnShowModal").click(function (e) {
                ShowDialog(true);
                e.preventDefault();
            });$("#btnClose").click(function (e) {
                HideDialog();
                e.preventDefault();
            });

        });

        function ShowDialog(modal) {
            $("#overlay").show();$("#dialog").fadeIn(300);

            if (modal) {
                $("#overlay").unbind("click");
            }
            else {$("#overlay").click(function (e) {
                    HideDialog();
                });
            }
        }

        function HideDialog() {
            $("#overlay").hide();$("#dialog").fadeOut(300);
        }</script><!-- grid script end --></head><body><form id="form1" runat="server"><div><h1>This is result page</h1><br /><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /><asp:Button ID="btnShowSimple" runat="server" Text="View Grid" onclick="ViewList_Click" /><br /><!-- grid started --><asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="employee_id" DataSourceID="SqlDataSource1" Visible="false" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"><Columns><asp:CommandField ShowSelectButton="True" /><asp:BoundField DataField="employee_id" HeaderText="employee_id" 
                    InsertVisible="False" ReadOnly="True" SortExpression="employee_id" /><asp:BoundField DataField="employee_name" HeaderText="employee_name" 
                    SortExpression="employee_name" /><asp:BoundField DataField="employee_age" HeaderText="employee_age" 
                    SortExpression="employee_age" /><asp:BoundField DataField="employee_cellnum" HeaderText="employee_cellnum" 
                    SortExpression="employee_cellnum" /><asp:BoundField DataField="employee_phonenum" HeaderText="employee_phonenum" 
                    SortExpression="employee_phonenum" /><asp:BoundField DataField="employee_country" HeaderText="employee_country" 
                    SortExpression="employee_country" /><asp:BoundField DataField="employee_province" HeaderText="employee_province" 
                    SortExpression="employee_province" /><asp:BoundField DataField="employee_city" HeaderText="employee_city" 
                    SortExpression="employee_city" /><asp:BoundField DataField="employee_address" HeaderText="employee_address" 
                    SortExpression="employee_address" /><asp:BoundField DataField="employee_email" HeaderText="employee_email" 
                    SortExpression="employee_email" /></Columns></asp:GridView><asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConflictDetection="CompareAllValues" 
            ConnectionString="<%$ ConnectionStrings:ZAINConnectionString %>" 
            DeleteCommand="DELETE FROM [Employee] WHERE [employee_id] = @original_employee_id AND (([employee_name] = @original_employee_name) OR ([employee_name] IS NULL AND @original_employee_name IS NULL)) AND (([employee_age] = @original_employee_age) OR ([employee_age] IS NULL AND @original_employee_age IS NULL)) AND (([employee_cellnum] = @original_employee_cellnum) OR ([employee_cellnum] IS NULL AND @original_employee_cellnum IS NULL)) AND (([employee_phonenum] = @original_employee_phonenum) OR ([employee_phonenum] IS NULL AND @original_employee_phonenum IS NULL)) AND (([employee_country] = @original_employee_country) OR ([employee_country] IS NULL AND @original_employee_country IS NULL)) AND (([employee_province] = @original_employee_province) OR ([employee_province] IS NULL AND @original_employee_province IS NULL)) AND (([employee_city] = @original_employee_city) OR ([employee_city] IS NULL AND @original_employee_city IS NULL)) AND (([employee_address] = @original_employee_address) OR ([employee_address] IS NULL AND @original_employee_address IS NULL)) AND (([employee_email] = @original_employee_email) OR ([employee_email] IS NULL AND @original_employee_email IS NULL))" 
            InsertCommand="INSERT INTO [Employee] ([employee_name], [employee_age], [employee_cellnum], [employee_phonenum], [employee_country], [employee_province], [employee_city], [employee_address], [employee_email]) VALUES (@employee_name, @employee_age, @employee_cellnum, @employee_phonenum, @employee_country, @employee_province, @employee_city, @employee_address, @employee_email)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT * FROM [Employee]" 
            UpdateCommand="UPDATE [Employee] SET [employee_name] = @employee_name, [employee_age] = @employee_age, [employee_cellnum] = @employee_cellnum, [employee_phonenum] = @employee_phonenum, [employee_country] = @employee_country, [employee_province] = @employee_province, [employee_city] = @employee_city, [employee_address] = @employee_address, [employee_email] = @employee_email WHERE [employee_id] = @original_employee_id AND (([employee_name] = @original_employee_name) OR ([employee_name] IS NULL AND @original_employee_name IS NULL)) AND (([employee_age] = @original_employee_age) OR ([employee_age] IS NULL AND @original_employee_age IS NULL)) AND (([employee_cellnum] = @original_employee_cellnum) OR ([employee_cellnum] IS NULL AND @original_employee_cellnum IS NULL)) AND (([employee_phonenum] = @original_employee_phonenum) OR ([employee_phonenum] IS NULL AND @original_employee_phonenum IS NULL)) AND (([employee_country] = @original_employee_country) OR ([employee_country] IS NULL AND @original_employee_country IS NULL)) AND (([employee_province] = @original_employee_province) OR ([employee_province] IS NULL AND @original_employee_province IS NULL)) AND (([employee_city] = @original_employee_city) OR ([employee_city] IS NULL AND @original_employee_city IS NULL)) AND (([employee_address] = @original_employee_address) OR ([employee_address] IS NULL AND @original_employee_address IS NULL)) AND (([employee_email] = @original_employee_email) OR ([employee_email] IS NULL AND @original_employee_email IS NULL))"><DeleteParameters><asp:Parameter Name="original_employee_id" Type="Int32" /><asp:Parameter Name="original_employee_name" Type="String" /><asp:Parameter Name="original_employee_age" Type="Int32" /><asp:Parameter Name="original_employee_cellnum" Type="String" /><asp:Parameter Name="original_employee_phonenum" Type="String" /><asp:Parameter Name="original_employee_country" Type="String" /><asp:Parameter Name="original_employee_province" Type="String" /><asp:Parameter Name="original_employee_city" Type="String" /><asp:Parameter Name="original_employee_address" Type="String" /><asp:Parameter Name="original_employee_email" Type="String" /></DeleteParameters><InsertParameters><asp:Parameter Name="employee_name" Type="String" /><asp:Parameter Name="employee_age" Type="Int32" /><asp:Parameter Name="employee_cellnum" Type="String" /><asp:Parameter Name="employee_phonenum" Type="String" /><asp:Parameter Name="employee_country" Type="String" /><asp:Parameter Name="employee_province" Type="String" /><asp:Parameter Name="employee_city" Type="String" /><asp:Parameter Name="employee_address" Type="String" /><asp:Parameter Name="employee_email" Type="String" /></InsertParameters><UpdateParameters><asp:Parameter Name="employee_name" Type="String" /><asp:Parameter Name="employee_age" Type="Int32" /><asp:Parameter Name="employee_cellnum" Type="String" /><asp:Parameter Name="employee_phonenum" Type="String" /><asp:Parameter Name="employee_country" Type="String" /><asp:Parameter Name="employee_province" Type="String" /><asp:Parameter Name="employee_city" Type="String" /><asp:Parameter Name="employee_address" Type="String" /><asp:Parameter Name="employee_email" Type="String" /><asp:Parameter Name="original_employee_id" Type="Int32" /><asp:Parameter Name="original_employee_name" Type="String" /><asp:Parameter Name="original_employee_age" Type="Int32" /><asp:Parameter Name="original_employee_cellnum" Type="String" /><asp:Parameter Name="original_employee_phonenum" Type="String" /><asp:Parameter Name="original_employee_country" Type="String" /><asp:Parameter Name="original_employee_province" Type="String" /><asp:Parameter Name="original_employee_city" Type="String" /><asp:Parameter Name="original_employee_address" Type="String" /><asp:Parameter Name="original_employee_email" Type="String" /></UpdateParameters></asp:SqlDataSource><!-- grid ended --></div></form></body></html>

Note: Please modify the grid with any sql database of your own.

Now here us my "result.aspx.cs" page:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Ajax
{
    public partial class ResultPage : System.Web.UI.Page
    {
        public string GetConnectionString()
        {
            //sets the connection string from your web config file "ApplicationServices" is the name of your Connection String
            return System.Configuration.ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            TextBox1.Text = GridView1.SelectedRow.Cells[2].Text;
            ViewState["Show"] = false;
            GridView1.Visible = false;
        }

        protected override void LoadViewState(object savedState)
        {
            base.LoadViewState(savedState);
            this.GridView1.Visible = ViewState["Show"] == null ? false : Convert.ToBoolean(ViewState["Show"].ToString());
        }

        protected void ViewList_Click(object sender, EventArgs e)
        {
            ViewState["Show"] = true;
            GridView1.Visible = true;
        }
    }
}

Problem:
both the pages works absolutely fine when i run them individually. But when i start from "index.aspx" page and it generates result page with the help of ajax, the "result.aspx" page doesnt works correctly. Result.aspx have java script functions which are not working within ajax generated div. Grid is not shown.

TabContainer - Show an aspx page in TabPanel

$
0
0

Hi all

I have a TabContainer with 4 tabs, it works fine, now I need to add a 5th tab but this must contains an aspx page.

What is the best way in order to accomplish this? Thanks for your time!

VS2008 - ASP.NET 3.5

Problem with Ajax ModalPopUp and UpdatePanel

$
0
0

Hi EveryOne,

I have a page which has Update panel to load the data list on page load itself. After loading the datalist i will show the Modal PopUp. 

We have 3 servers:- DEV, MO and PROD.

Same code works well and good in DEV & in MO but not in PROD. we have issues only with PROD. getting the following error,

PortalPage:PAGE ERROR HANDLER start Category: UI
PAGE ERROR HANDLER:LastError Exception: Caused by Exception HttpParseException : Root element is missing. Key:[ASPIMPERSONATING] Value:[] at System.Web.Compilation.AssemblyBuilder.AddBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) at System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) at System.Web.Compilation.BuildManager.EnsureFirstTimeDirectoryInit(VirtualPath virtualDir) at System.Web.Compilation.BuildManager.GetBuildResultFromCacheInternal(String cacheKey, Boolean keyFromVPP, VirtualPath virtualPath, Int64 hashCode) at System.Web.Compilation.BuildManager.GetVPathBuildResultFromCacheInternal(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilatio

And also am not getting this error always. if i refresh thepage sometimes it gets resolved or some different error. i.e. it is inconsistent.

Please suggest any help..

Refreshing page when closing modalpopup

$
0
0

I have 2 ajax modal popups (I've omitted most of the code), when I close them I want to rebind the page behind which contains a datagrid. I have tried trying to trap the postback control and rebinding only when that control is listed as there are other postback controls on the page, but it's not working.  Any help would be greatly appreciated...

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Frm.aspx.cs" Inherits="Prj.Frm" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"><script type="text/javascript" language="javascript" src="Scripts/script.js"> </script><script src="Scripts/jquery-1.8.3.js" type="text/javascript"></script><script src="Scripts/jquery-ui-1.9.2.custom.js" type="text/javascript"></script><link href="Styles/post_ui.css" rel="stylesheet" type="text/css" /><asp:ScriptManager runat="server" ID="scriptManager" EnablePageMethods="true"></asp:ScriptManager><asp:ModalPopupExtender ID="mpeNV" BehaviorID="mpeNV" runat="server"
        TargetControlID="btnShowPopupNV" PopupControlID="pnlpopupNV" CancelControlID="imgCancelNV"
        BackgroundCssClass="modalBackground" /><asp:Panel ID="pnlPopupNV" runat="server" Width="700px" Style="display: none;"
        class="ModalPanel"><asp:Panel ID="pnlInnerNV" runat="server" BackColor="white" Width="700px"><table style="width: 700px;" ><tr><td width="10px">&nbsp;</td><td align="left"><asp:Label ID="Label3" runat="server" Text="New" CssClass="norm_w" Font-Bold="True"></asp:Label></td><td align="right"><img src="images/close.png" id="imgCloseNV" alt="" style="cursor: hand" onclick=" $find('mpeNV').hide();"
                            width="15" height="15" /></td></tr><!--Popup Controls Here --></table><asp:Button ID="imgCancelNV" Text="Cancel" runat="server" OnClick="imgCancelNV_Click" /></asp:Panel></asp:Panel><!--Popup 2 Here --><div><asp:DataGrid ID="dg" runat="server"></asp:DataGrid></div></asp:Content>


Code behind...

protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

               //Do some stuff then

                BindData();
            }
            else
            {
                string CtlName = Page.Request.Params.Get("__EVENTTARGET");
                if (!string.IsNullOrEmpty(CtlName))
                {
                    // Looking for the control ID
                    // string sControl = Page.FindControl(CtlName).ClientID;
                    if ((CtlName.Contains("dg")) || (CtlName.Contains("imgCancel")) || (CtlName.Contains("imgCancelNV")))
                    {
                        BindData();
                    }
                }

            }


        }

    protected void imgCancelNV_Click(object sender, EventArgs e)
            {
                this.mpeNV.Hide();
                //Have tried this with and without binddata
               BindData();
            }


Viewing all 5678 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>