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

Edit gridview within a gridview using CollapsiblePanelExtender

$
0
0

Hi All,

 I've been stuck on this for a little while, so I hope someone will be able to help me.

I've got a parent gridview showing the sales orders headers, then within this gridview a child gridview showing the lines. I use a CollapsiblePanelExtender to show the lines.

All this works fine.

However, I've got an "edit" button in the lines that is firing the rowEditing event but the line doesn't change to the edit mode.

Here is the aspx code

<asp:UpdatePanel ID="pnlUpdate" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false"><ContentTemplate><asp:GridView ID="GridViewOrderRequests" runat="server" ForeColor="#333333"
         Width="100%" AutoGenerateColumns="False" GridLines="None"
         DataSourceID="SqlDataSourceOrderRequests" AllowSorting="True" EnableTheming="True"
         OnRowCreated="GridViewOrderRequests_RowCreated" DataKeyNames="No_"><Columns><asp:TemplateField><HeaderTemplate><table class="tabExpand" width="100%"><tr><th width="5%"></th><th class="thExpand" width="10%">No</th><th class="thExpand" width="10%">Customer No</th><th class="thExpand" width="75%">Customer Name</th></tr></table></HeaderTemplate><ItemTemplate><asp:Panel ID="pnlOrderRequests" runat="server" ><table class="tabExpand" width="100%"><tr><td class="tdExpand" width="5%"><asp:Image ID="imgCollapsible" runat="server" /></td><td class="tdExpand" width="10%"><asp:Label ID="Label1" runat="server" Text='<%# Bind("[No_]") %>'></asp:Label></td><td class="tdExpand" width="10%"><asp:Label ID="Label5" runat="server" Text='<%# Bind("[Customer No_]") %>'></asp:Label></td><td class="tdExpand" width="75%"><asp:Label ID="Label6" runat="server" Text='<%# Bind("[Customer Name]") %>'></asp:Label></td></tr></table></asp:Panel><asp:SqlDataSource ID="SqlDataSourceOrderRequestDetail" runat="server"
                                    ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                                    SelectCommand="OrderRequestDetail" SelectCommandType="StoredProcedure"><SelectParameters><asp:Parameter Name="RequestNo" Type="String"  /></SelectParameters></asp:SqlDataSource><asp:Panel ID="pnlDetails" runat="server" Width="75%" Style="margin-left:20px;margin-right:20px;height:0px;overflow: hidden;"><asp:GridView ID="GridViewOrderRequestDetail" runat="server" CellPadding="2" AutoGenerateColumns="False"
                                        DataSourceID="SqlDataSourceOrderRequestDetail"
                                        AllowSorting="True" EnableTheming="True"
                                        BorderWidth="1px" BorderColor="#5D7B9D" BorderStyle="Solid"
                                        RowStyle-Font-Names="calibri" RowStyle-Font-Size="10"
                                            HorizontalAlign="Center" DataKeyNames="No_,Line No_" OnRowEditing="GridViewOrderRequestDetail_RowEditing"><Columns><asp:TemplateField HeaderText="Item No" SortExpression="Item No_"><ItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Bind("[Item No_]") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Description" SortExpression="Description" ItemStyle-HorizontalAlign="left"><ItemTemplate><asp:Label ID="Label2" runat="server" Text='<%# Bind("[Description]") %>'></asp:Label></ItemTemplate><ItemStyle HorizontalAlign="Left"></ItemStyle></asp:TemplateField><asp:TemplateField HeaderText="Unit Of Measure" SortExpression="Unit Of Measure" ItemStyle-HorizontalAlign="left"><ItemTemplate><asp:Label ID="Label3" runat="server" Text='<%# Bind("[Unit Of Measure]") %>'></asp:Label></ItemTemplate><ItemStyle HorizontalAlign="Left"></ItemStyle></asp:TemplateField><asp:TemplateField HeaderText="Unit Price" SortExpression="Unit Price" ItemStyle-HorizontalAlign="left"><ItemTemplate><asp:Label ID="Label4" runat="server" Text='<%# Bind("[Unit Price]", "{0:n2}") %>'></asp:Label></ItemTemplate><ItemStyle HorizontalAlign="Left"></ItemStyle></asp:TemplateField><asp:TemplateField HeaderText="Quantity" SortExpression="Quantity" ItemStyle-HorizontalAlign="Right"><ItemTemplate><asp:Label ID="Label5" runat="server" Text='<%# Bind("[Quantity]", "{0:n2}") %>'></asp:Label></ItemTemplate><EditItemTemplate><asp:TextBox ID="TxtQty" runat="server" Text='<%# Bind("[Quantity]", "{0:n2}") %>'></asp:TextBox></EditItemTemplate><ItemStyle HorizontalAlign="Right"></ItemStyle></asp:TemplateField><asp:TemplateField ShowHeader="False" ItemStyle-Width="3%"><ItemTemplate><asp:ImageButton ID="ImgEditOrderRequest" runat="server" ImageUrl="~/Pictures/EditSmall.png" title="Edit" CommandName="Edit"/></ItemTemplate><HeaderStyle Width="3%" /><ItemStyle Width="3%" HorizontalAlign="Center" /></asp:TemplateField><asp:TemplateField ShowHeader="False" ItemStyle-Width="2%"><ItemTemplate><asp:ImageButton ID="ImgFinaliseOrderRequest" runat="server" OnClientClick="return confirm('Do you want to finalise this order request?');"
                                                        ImageUrl="~/Pictures/FinaliseSmall.png" title="Finalise"/></ItemTemplate><HeaderStyle Width="2%" /><ItemStyle Width="2%" Font-Names="calibri" HorizontalAlign="Center" /></asp:TemplateField></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /><SortedAscendingCellStyle BackColor="#E9E7E2" /><SortedAscendingHeaderStyle BackColor="#506C8C" /><SortedDescendingCellStyle BackColor="#FFFDF8" /><SortedDescendingHeaderStyle BackColor="#6F8DAE" /></asp:GridView></asp:Panel><asp:CollapsiblePanelExtender
                                   ID="ctlCollapsiblePanel"
                                    runat="Server"
                                    TargetControlID="pnlDetails"
                                    CollapsedSize="0" Collapsed="True"
                                    ExpandControlID="pnlOrderRequests"
                                    CollapseControlID="pnlOrderRequests"
                                    AutoCollapse="False" AutoExpand="False"
                                    ScrollContents="false"
                                    ImageControlID="imgCollapsible"
                                    ExpandedImage="~/Pictures/Expand.png"
                                    CollapsedImage="~/Pictures/Collapse.png"
                                    ExpandDirection="Vertical" /></ItemTemplate></asp:TemplateField></Columns><RowStyle Font-Names="calibri" Font-Size="10pt" /></asp:GridView></ContentTemplate></asp:UpdatePanel>

here is the c#

protected void GridViewOrderRequestDetail_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView GvLines = sender as GridView;
        GvLines.EditIndex = e.NewEditIndex;
        GvLines.DataBind();  }

Any Help would be really appreciated.

Cheers


ASP.Net 4.5 Validation Controls not working with AJAX ToolkitScriptManager1

$
0
0

All,

I have a project in which I am using the 'unobtrusive.....' validation so it includes the references to all the JScript libraries in the global.asax. I also have pages that utilize the ASP.Net Validation controls and summary. For some reason I cannot get the validation controls to work correctly. Below is a summary of my challengers:

1. The first time the page loads, on the client side, when tabbing out of a field that has a required field validator attached to it, the "text" assigned to the validator does not display

2. If I click the submit button, the "text" associated with the required field validator now displays but I don't get the pop-up window from my validation summary.

3. If I then enter text in the text boxes that have required field validators assigned, the "text" assigned will not disappear until I click on the submit button.

My ASPX page code is below and I have nothing in my code behind.  I have also tried with the script manager inside and outside the update panel.  Any assistance would be greatly appreciated.  

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test1.aspx.vb" Inherits="test1" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title></head><body><form id="form1" runat="server"><asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" ></asp:ToolkitScriptManager><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><div><asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="RequiredFieldValidator" ValidationGroup="contentgroup">*</asp:RequiredFieldValidator><br /><asp:Label ID="Label2" runat="server" Text="Label"></asp:Label><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2" ErrorMessage="RequiredFieldValidator"  ValidationGroup="contentgroup">*</asp:RequiredFieldValidator><br /><asp:Button ID="Button1" runat="server" Text="Button" ValidationGroup="contentgroup" /><asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="contentgroup" ShowMessageBox="True" ShowSummary="False" /></div></ContentTemplate></asp:UpdatePanel></form></body></html>

AjaxControlToolkit issue: Unable to get the property UI

$
0
0

Hi Folks,

I am trying to use a rounded corners extender on an aspx page for an asp:Panel control (I have also tried the drop shadow extender).   When I run the application I get the error message:  Microsoft JScript runtime error: Unable to get the value of the property UI: object is null or undefined.

The offending line is:-

$create(Sys.Extended.UI.RoundedCornersBehaviour, { "id":"MainContent_RCE"},null,null,$get("MainContent_pnlX"));

The project is just a standard VS2010 .Net 4, C# Web Application.   The page is in the ~/Forms sub-directory of the project and is protected by a web.config in that directory which contains a "deny users="?" section.  The user cannot access the page until they have logged in.

If I remove the reference to the rounded corners extender from the page, everything works fine (except not rounded corners), when I add the markup back, the application again fails.

After a little testing I found that if I move the the aspx page to the root directory of the application where the user does not have to login, the error message goes away and the rounded corners extender then works.

It also works if I remove the web.config from the sub-directory (and remove the access protection)

Would anyone have a work-a-round for getting it working with the access protection?   

Regards

Andy

AJAX AutoComplete Extender Not Working

$
0
0

Hello Guys,

To Start with I want to implement suggestion dropdown in my textbox based upon the records stored in my sql server database..

I googled and found out that Ajax autocomplete extender will be my best bet..

So I started with this article:

http://www.aspsnippets.com/Articles/AJAX-AutoCompleteExtender-Example-in-ASPNet.aspx

It uses Northwind Database and when I downloaded the sample.. It was working good as well..

The problem started when I tried to implement the same concept in a separate project..

To My horrors It was not working.. I tried to figure out and found that I was using ajax toolkit version 1.0.x in my project while in the downloaded sample it was 3.0.x

So I copy pasted the ajax toolkit files from the downloaded sample and and pasted over in the bin folder of my project..

also I added reference to .dll file with my project and removed the older ajax toolkit toolbars..

I tried to make the project similar to downloaded sample.. But still its not working.. It is simply opening and showing no suggestions while typing,,,

Please HELP how to overcome this problem.. I HAVE to implement this on large scale,, So what could be the possible reasons..

What I am missing..

Note: I have not used ajax much.. Not have indepth knowledge of it as well..

Frown

How to pop up ppt files in Power Point

$
0
0

Hi,

I have requirement like...i want to upload Power Point Presntation Files in server.

After Uploading the file names will show in DataGridView or any other repeter control.

When i clicked the FileName in GridView then the file name will pop up as light box and will show as like power point presentation.

Please help me,

Thanks,

Date and timestamps error

$
0
0

Hi guys ,

I am trying to import a excel file into my database and i have checked the date and time stamps in the database

based on that have made the template and still i get an error please assist

Server Error in '/xxx' Application. String was not recognized as a valid DateTime. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  Exception Details: System.FormatException: String was not recognized as a valid DateTime.  Source Error:  Line 100:    cmd.Parameters.Add("@opentime", SqlDbType.DateTime) Line 101:    cmd.Parameters("@opentime").Value = GridView2.Rows.Item(i).Cells(4).Text Line 102:    cmd.ExecuteNonQuery() Line 103:    If i = GridView2.Rows.Count - 1 Then Line 104:    Response.Redirect("dispatcher.aspx")  [FormatException: String was not recognized as a valid DateTime.]    System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +2291962    System.DateTime.Parse(String s, IFormatProvider provider) +26    System.Convert.ToDateTime(String value, IFormatProvider provider) +56    System.String.System.IConvertible.ToDateTime(IFormatProvider provider) +10    System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +2560945    System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType) +896  [FormatException: Failed to convert parameter value from a String to a DateTime.]    System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType) +943    System.Data.SqlClient.SqlParameter.GetCoercedValue() +29    System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc) +97    System.Data.SqlClient.SqlCommand.BuildParamList(TdsParser parser, SqlParameterCollection parameters) +166    System.Data.SqlClient.SqlCommand.BuildExecuteSql(CommandBehavior behavior, String commandText, SqlParameterCollection parameters, _SqlRPC& rpc) +253    System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1005    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132    System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +149    System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135    dispatcher.Button2_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\xxx\dispatcher.aspx.vb:102    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

HTML Editor writes 111 on document(IE9)

$
0
0

Hi all,

When using HTML editor indent buttons, it prints 111 in the top of the page(IE9).

Steps

  1. Press decrease indent
  2. Press increase indent
  3. Press hyperlink
  4. Press cancel
  5. Press decrease indent

The issue occurs only in IE9. Does anybody know how this happen?

Thanks in advance,

Binoj KN

Exclude div from UpdatePanel

$
0
0

Hi I have a div within an UpdatePanel which I need to exclude but it sits between all other elements that requires to be in the panel. 

E.g:

<asp:UpdatePanel ID="upPanel1" runat="server" UpdateMode="Conditional"><ContentTemplate><div1><div2><div3></ContentTemplate></asp:UpdatePanel>

I need to exclude <div2> from the updatepanel but at the same time it needs to be below <div1>. Is there a better way than setting div2 position to absolute? Thanks.


HTMLEditor - can not read the modified text

$
0
0

Hi all,

I'm using HTMLEditor for my web page. But after changing the content, I can't read the current text of this object. Can anyone explain me why? Thanks very much.

<%@ Page Title="FX News Management" Language="C#" MasterPageFile="~/Site.Master"
    AutoEventWireup="true" CodeBehind="FxForumManagement.aspx.cs" Inherits="SacombankFxMarkets.QuantTeam.FxMarkets.FxForums.FxForumManagement"
    EnableEventValidation="false"%><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor"
    TagPrefix="htmlEditor" %><asp:ToolkitScriptManager ID="ajaxToolkitScriptManager" runat="server" EnablePartialRendering="true"></asp:ToolkitScriptManager><asp:UpdatePanel ID="updatePanelNewsContent" runat="server"><ContentTemplate><htmlEditor:Editor ID="txtNewsContent" runat="server" Height="300px" Width="100%" /><br /><asp:Button ID="btnNewsSubmit" runat="server" Text="Submit"
                                            onclick="btnNewsSubmit_Click" /></ContentTemplate></asp:UpdatePanel>



Changing date selection in CalendarExtender using up, down, left, right arrow keys

$
0
0

The CalendarExtender control is awesome.  My only issue with it is that, when the textbox date field is entered by tabbing (using the keyboard), the calendar pops up and the user isforced to use the mouse to make a selection, even if the selection is today.  Many users like to be able to hit a key or a couple keys to select a date close to today without having to take their hands off the keyboard.

I solved this by adding a simple javascript fuction that is shared below in case anyone else has a similar need.  The result is a CalendarExtender control that you can tab into, hit an arrow to initialize the selection with today's date, then continue (if you wish) to use up, down, and side arrows to move back one week, forward one week, or by single day before or after.  Please post any improvements.

    function DateField_KeyDown(dateField, calendarExtenderName)
    {
        lastKeyCodeEntered=window.event.keyCode;
        if ((lastKeyCodeEntered == '37')        //keyCode 37=left arrow
            || (lastKeyCodeEntered == '38')     //keyCode 38=up arrow
            || (lastKeyCodeEntered == '39')     //keyCode 39=right arrow
            || (lastKeyCodeEntered == '40'))    //keyCode 40=down arrow
        {
            var dtbehav = $find(calendarExtenderName);
            var enteredDate = dtbehav.get_selectedDate();

            if (enteredDate == null)
            {
                enteredDate = new Date();
            }
            else
            {
                advanceValue = 0;
                switch (lastKeyCodeEntered)
                {
                    case 37:
                        advanceDays = -1;
                        break;
                    case 38:
                        advanceDays = -7;
                        break;
                    case 39:
                        advanceDays = 1;
                        break;
                    case 40:
                        advanceDays = 7;
                        break;
                }
                enteredDate.setDate(enteredDate.getDate() + advanceDays);
            }
            dateField.value = (enteredDate.getMonth()+1) + "/" + enteredDate.getDate() + "/" + enteredDate.getFullYear();
            dtbehav.set_selectedDate(dateField.value);
        }
    }

Then I simply wired the above javascript function to my textbox's "onkeydown" event in the (server-side) Page_Load for my page:

txtDateReceived.Attributes.Add("onkeydown","DateField_KeyDown(this,'"+ myCalendarExtenderID.ClientID +"')");

 

RE: RE: Re: Onclick() method in ajaxtoolkit control &amp;quot;Rating&amp;quot;

$
0
0

 Hi, I'm using framework 3.5, mssql 2005 and ajaxtoolkit control "Rating".

There is no Onclick() method =(, only onchenged().

If currentrating 3 and user click 3 it doesn't work, when I'm trying to bind data in to database.

Is the any solver for this problem?

Please help.

This is my code:

.aspx:

<html  >
  <head id="Head1" runat="server">
 
    <title>ASP.NET Example</title>
    <style>
   
            /* The following styles are for the Rating */
       
                .ratingStar {
                font-size: 0pt;
                width: 13px;
                height: 12px;
                margin: 0px;
                padding: 0px;
                cursor: pointer;
                display: block;
                background-repeat: no-repeat;
            }

            .filledRatingStar {
                background-image: url(Images/FilledStar.png);

            }

            .emptyRatingStar {
                background-image: url(Images/EmptyStar.png);
            }

            .savedRatingStar {
                background-image: url(Images/SavedStar.png);
            }
           
           
            /******************************************/   
   
    </style>
</head>
<body>
    <form id="form1" runat="server">

 <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
       
       
         <asp:UpdateProgress ID="UpdateProgress1" runat="server"
        AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="1">
        <ProgressTemplate>
       
            Loading...........
        </ProgressTemplate>
    </asp:UpdateProgress>
   
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
    
            <asp:FormView ID="FormView1" runat="server" DataKeyNames="id"
                DataSourceID="SqlDataSource1" DefaultMode="Insert">
               
                <InsertItemTemplate>
                    <asp:Panel ID="Panel1" runat="server">
                  
                    <cc1:Rating ID="Rating1" runat="server"
                        CurrentRating='2'
                        EmptyStarCssClass="emptyRatingStar" FilledStarCssClass="filledRatingStar"
                        StarCssClass="ratingStar" WaitingStarCssClass="savedRatingStar"
                        CommandName="Insert" AutoPostBack="true" OnChanged="Rating2_Changed2"  >
                    </cc1:Rating>


                     </asp:Panel>
                  
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("CustomerRating") %>'></asp:Label>                   
                </ItemTemplate>
            </asp:FormView>
           
           
           
           
           
                    <br />
                    <br />

      <asp:sqldatasource
        id="SqlDataSource1"
        runat="server"
        connectionstring="<%$ ConnectionStrings:ConnectionString %>"
        selectcommand="SELECT * FROM [Table1]"
       
        insertcommand="INSERT INTO [Table1] ([CustomerRating]) VALUES (@CustomerRating)"
        oninserting="SqlDataSource1_Inserting">
          <insertparameters>
             <asp:QueryStringParameter Name="CustomerRating"
                        QueryStringField="CustomerRating" Type="String" />
          </insertparameters>
      </asp:sqldatasource>

    <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1"
                AutoGenerateColumns="False" DataKeyNames="id">
        <Columns>
            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False"
                ReadOnly="True" SortExpression="id" />
            <asp:BoundField DataField="CustomerRating" HeaderText="CustomerRating"
                SortExpression="CustomerRating" />
        </Columns>
    </asp:GridView>

     </ContentTemplate>
      
    </asp:UpdatePanel>

    </form>
  </body>
</html>

 

.cs:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
      
    }
    protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e)
    {
        AjaxControlToolkit.Rating Rating2 = (AjaxControlToolkit.Rating)FormView1.FindControl("Rating1");
        e.Command.Parameters["@CustomerRating"].Value = Rating2.CurrentRating;
    }
 
    protected void Rating2_Changed2(object sender, AjaxControlToolkit.RatingEventArgs e)
    {
         int value = int.Parse(e.Value);
         string result = string.Empty;
         switch (value)
         {
             case 0:
                
                 SqlDataSource1.Insert();
                 break;
             case 1:
                 SqlDataSource1.Insert();
                 break;
             case 2:
                 SqlDataSource1.Insert();
                 break;
             case 3:
                 SqlDataSource1.Insert();
                 break;
             case 4:
                 SqlDataSource1.Insert();
                 break;
             case 5:
                 SqlDataSource1.Insert();
                 break;

         }


       
    }
  
}
 

 

 

asynchronous postback causes PageRequestManagerParserErrorException

$
0
0

Hello,

People, please help me...

I have a aspx page with 2 update panels and 2 buttons (btnFilter and btnClear) that are not in an update panel. One button is an asyncpostback trigger of one update panel, and the other button is an  asyncpostback trigger of the second update panel. (I have a lot of pages with the same structure, but the problem is just in this one). When I click on one of these buttons, or a button in the update panel (btnRefresh), I get the following error:

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

(Thats all I get, without the usual "Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled." and with no details).

When I change these two buttons to be PostBackTrigger instead of asyncpostback trigger, I don't get this error, though it causes a full postback of the page, wich I don't want to happen. And, there is still the same problem with the button that inside the update panel.

Does anyone knows what's the problem?

<form id="Form1" method="post" runat="server"><asp:ScriptManager runat="server" ID="scriptManager1"></asp:ScriptManager><script type="text/javascript" language="javascript">
							         var prm = Sys.WebForms.PageRequestManager.getInstance();
							         prm.add_initializeRequest(InitializeRequest);
							         prm.add_endRequest(EndRequest);
							         var postBackElement;

							         function InitializeRequest(sender, args) {
							             if (prm.get_isInAsyncPostBack())
							                 args.set_cancel(true);
							             postBackElement = args.get_postBackElement();

							             if (postBackElement.id != 'btnClear')
							                 $get('UpdateProgress1').style.display = 'block';
							         }
							         function EndRequest(sender, args) {
							             if (postBackElement.id != 'btnClear')
							                 $get('UpdateProgress1').style.display = 'none';

							         }
			                      </script><table border="0" cellpadding="0" cellspacing="0"><tr><td><asp:UpdatePanel ID="UPnl" runat="server" UpdateMode="Conditional"><triggers><asp:AsyncPostBackTrigger ControlID="btnClear" EventName="Click" ></asp:AsyncPostBackTrigger></triggers><ContentTemplate><asp:panel id="pnlFilter" runat="server" Wrap="False"><fieldset class="styleBoxField"><legend style="COLOR: #264b00">Permission Event Log Filtering</legend><asp:Table id="Table5" runat="server" cellspacing="1" CellPadding="1" width="100%"><asp:TableRow><asp:TableCell width="10"></asp:TableCell><asp:TableCell width="10">User</asp:TableCell><asp:TableCell><select id="hsUser" class="styleInput" name="hsUser" runat="server"></select></asp:TableCell><asp:TableCell width="50"></asp:TableCell><asp:TableCell>Start Time</asp:TableCell><asp:TableCell><asp:TextBox ID="tbStartDate" runat="server" Text="enter date" ForeColor="GrayText" onClick="clearTB('tbStartDate')" Width="80"></asp:TextBox><ajaxToolkit:CalendarExtender TargetControlID="tbStartDate" ID="calStart" runat="server"></ajaxToolkit:CalendarExtender></asp:TableCell><asp:TableCell><asp:TextBox runat="server" ID="tbStartTime" Text="HH:MM" ForeColor="GrayText" Width="60"
                                                                     onclick="clearTimeTb('tbStartTime')" onblur="validateTime('tbStartTime')"></asp:TextBox></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell width="10"></asp:TableCell><asp:TableCell width="70">Machine IP</asp:TableCell><asp:TableCell><input type="text" id="textUserMachine" class="styleInput" runat="server" name="textUserMachine" /></asp:TableCell><asp:TableCell width="10"></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell width="10"></asp:TableCell><asp:TableCell>Permission Option</asp:TableCell><asp:TableCell><asp:DropDownList runat="server" ID="ddlPermissionOption"></asp:DropDownList></asp:TableCell><asp:TableCell width="50"></asp:TableCell><asp:TableCell>End Time</asp:TableCell><asp:TableCell><asp:TextBox ID="tbEndDate" runat="server" Width="80" Text="enter date" ForeColor="GrayText" onclick="clearTB('tbEndDate')"></asp:TextBox><ajaxToolkit:CalendarExtender TargetControlID="tbEndDate" ID="calEnd" runat="server"></ajaxToolkit:CalendarExtender></asp:TableCell><asp:TableCell><asp:TextBox runat="server" ID="tbEndTime" Text="HH:MM" ForeColor="GrayText" Width="60"
                                                                     onclick="clearTimeTb('tbEndTime')" onblur="validateTime('tbEndTime')"></asp:TextBox></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell width="10"></asp:TableCell><asp:TableCell>Permission</asp:TableCell><asp:TableCell><asp:DropDownList runat="server" ID="ddlPermissions"></asp:DropDownList></asp:TableCell><asp:TableCell width="10"></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell width="10"></asp:TableCell><asp:TableCell>Mac Address</asp:TableCell><asp:TableCell><asp:TextBox runat="server" ID="tbMacAddress" CssClass="styleInput" ToolTip="wildcards supported"></asp:TextBox></asp:TableCell><asp:TableCell width="10"></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell width="10"></asp:TableCell><asp:TableCell>Switch IP</asp:TableCell><asp:TableCell><asp:TextBox runat="server" ID="tbSwitchIP" CssClass="styleInput" ToolTip="wildcards supported"></asp:TextBox></asp:TableCell><asp:TableCell width="10"></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell width="10"></asp:TableCell><asp:TableCell>Switch group</asp:TableCell><asp:TableCell><asp:DropDownList runat="server" ID="ddlSwitchGroup"></asp:DropDownList></asp:TableCell><asp:TableCell width="10"></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell width="10"></asp:TableCell><asp:TableCell>User comment</asp:TableCell><asp:TableCell><asp:TextBox runat="server" ID="tbComment" CssClass="styleInput" ToolTip="Enter all or part of the comment the user wrote when he changed the station permission"></asp:TextBox></asp:TableCell><asp:TableCell width="10"></asp:TableCell></asp:TableRow></asp:Table></fieldset></asp:panel></ContentTemplate></asp:UpdatePanel><!--buttons---><asp:Table runat="server" CellPadding="0"><asp:TableRow><asp:TableCell><asp:Button id="btnFilter" runat="server" Text="Filter" CssClass="styleButton"
																	    ToolTip="Filter according to the given criteria"></asp:Button></asp:TableCell><asp:TableCell><asp:Button id="btnClear" runat="server" Text="Clear" CssClass="styleButton" ToolTip="Clear criteria fields"></asp:Button></asp:TableCell></asp:TableRow></asp:Table></td></tr></table><asp:UpdatePanel ID="UPnl2" runat="server" UpdateMode="Conditional"><triggers><asp:AsyncPostBackTrigger ControlID="btnFilter" EventName="Click" ></asp:AsyncPostBackTrigger></triggers><ContentTemplate><table border="0" cellpadding="0" cellspacing="0"><tr><td height=20px></td></tr><tr><td><asp:panel id="pnlResults" runat="server"><asp:Table height="28px"  id="Table6" runat="server" Width="<%#nInnerComponentWidth %>" cellspacing="0" CellPadding="0" CssClass="styleTableHeaderResults"><asp:TableRow><asp:TableCell width="1%"></asp:TableCell><asp:TableCell>Filtered Results:</asp:TableCell><asp:TableCell><asp:Label id="lblResults" runat="server" Width="48px" Text=""></asp:Label></asp:TableCell><asp:TableCell width="50"></asp:TableCell><asp:TableCell width="70%"></asp:TableCell><asp:TableCell width="3%" HorizontalAlign="Right"><asp:Button id="btnRefresh" runat="server" ToolTip="refresh" CssClass="styleRefreshIcon"></asp:Button></asp:TableCell><asp:TableCell Width="3%" HorizontalAlign="Right"><asp:Button id="btnExcelExport" CssClass="styleExcelExportIcon" runat="server" Text="" ToolTip="Export to Excel"></asp:Button></asp:TableCell><asp:TableCell width="1%"></asp:TableCell></asp:TableRow></asp:Table></asp:panel></td></tr><tr><td><div id="divResults" runat="server" style="overflow:auto; height:600" class="styleScrollColors" ><asp:datagrid id="DataGrid1"
												CssClass="styleBoxTable"
												runat="server"
												CellPadding="0"
												Cellspacing="0"
												OnSortCommand="DataGrid1_Sort"
												AllowSorting="True"
												AutoGenerateColumns="False"
												width="<%#nInnerComponentWidth %>"
												PageSize="100"
												PagerStyle-BackColor="LightGrey"
												PagerStyle-ForeColor="DimGray"
												HeaderStyle-CssClass="styleTableHeader styleDataGridFixedHeader"
												HeaderStyle-HorizontalAlign="Center"><SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#669999"></SelectedItemStyle><ItemStyle ForeColor="#000000" HorizontalAlign="Center"></ItemStyle><Columns><asp:BoundColumn DataField="UserName" HeaderText="User Name" SortExpression="UserName"></asp:BoundColumn><asp:BoundColumn DataField="UserIPAddress" HeaderText="Machine IP" SortExpression="UserIPAddress"></asp:BoundColumn><asp:BoundColumn DataField="strDate" HeaderText="Date" SortExpression="Date"></asp:BoundColumn><asp:BoundColumn DataField="MacAddress" HeaderText="Mac Address" SortExpression="MacAddress"></asp:BoundColumn><asp:BoundColumn DataField="SwitchIP" HeaderText="Switch IP" SortExpression="SwitchIP"></asp:BoundColumn><asp:BoundColumn DataField="SwitchGroupID" Visible="false"></asp:BoundColumn><asp:BoundColumn DataField="SwitchGroupName" HeaderText="Switch Group" SortExpression="SwitchGroupName"></asp:BoundColumn><asp:BoundColumn DataField="VerificationOption" HeaderText="Verification Option" SortExpression="VerificationOption"></asp:BoundColumn><asp:BoundColumn DataField="Comment" HeaderText="Comment" SortExpression="Comment"></asp:BoundColumn><asp:BoundColumn DataField="NewPermission" Visible="false"></asp:BoundColumn><asp:TemplateColumn HeaderText="Permission Description"><ItemTemplate><asp:Label runat="server" ID="lblPermissionDesc"></asp:Label></ItemTemplate></asp:TemplateColumn></Columns><PagerStyle Height=22px HorizontalAlign="Left" Mode="NumericPages"></PagerStyle></asp:datagrid></div></td></tr></table><asp:Label id="lblLastSortExpression" runat="server" Width="0px" Visible="False">UserName</asp:Label><asp:Label id="lblLastSortDirection" runat="server" Width="0px" Visible="False">DESC</asp:Label></ContentTemplate></asp:UpdatePanel><asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UPnl2" runat="server" DisplayAfter="500"><ProgressTemplate><div id="IMGDIV" align="center" valign="middle" runat="server" style="position: absolute;left: 50%;top: 80%;visibility:visible;vertical-align:middle;background-color:Transparent;"><asp:Image ID="Image1" runat="server" ImageUrl="../../Images/ajax-loader.gif" /></div></ProgressTemplate></asp:UpdateProgress></form>



ASP Forums

$
0
0

Hi ,

I need help, I need to understand forum writing technique. I don't know how to start.

Regards

Question regarding ajax Editor control

$
0
0
<ul><li class="field"><cc1:Editor ID="Editor1" runat="server" /><br /><span class="desc"><asp:RequiredFieldValidator ID="rqrdcontent" runat="server" ControlToValidate="Editor1"
                        ErrorMessage="You must enter description" Display="Dynamic" ValidationGroup="g"
                        CssClass="input_error"></asp:RequiredFieldValidator><asp:RegularExpressionValidator ID="regexpContent" runat="server" ErrorMessage="Description shouldn't be less than 30 characters"
                      ValidationGroup="g"  ControlToValidate="Editor1" CssClass="input_error" Display="Dynamic"
                        ValidationExpression="(\s|.){30,1000}"></asp:RegularExpressionValidator></span></li></ul>

This is my editor controls which works fine with normal text, with out applying any styles or some other other, but when I apply styles the regular expression validator doesn't works, can some one tell me why it is happening. For example if I type some text and make it as bold the validation of regular expression didn't worked as per required

asp, css issue

$
0
0

hi,

I have the selected code:

.imgFairy
{
background-color:Red;
}

<td>

<div>

<div>

<div>

<asp:Image ID="Image2" runat="server" CssClass="imgFairy"
ImageUrl="~/Pics/emothions/fairy32.gif" /> .........................................

 CssClass="imgFairy" doesn't work, why?

can anybody help me?


HtmlEditor text to h3 ore p

$
0
0

Hey

I have a small problem, when I'm saving the text from a textbox with HtmlEditorExtender and save it in a database, and the takes it into a h3, p ore div, it writes the code as well, like "text&sbnp;text", I have tryed to replace it, but it will not always work

Is ther some way to do it ?

How to add Table and Div inside Ajax Tab container?

$
0
0

I am developing a webpage wher i am having a Tab Container which contains a few tabs.

The tabs start from the left hand side of the page.

I need to place table inside Tab container but it says table and div cannot be placed inside Tab container. I want to align this tabs as per my requirement.

How can i achive this? Below is the code what i have tried.

<asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">
  <table>
  <tr>
  <td>
<asp:TabPanel runat="server" HeaderText="Applicant's Particulars" ID="TabPanel1">

<ContentTemplate>

</Content Template>

</asp:Tab Panel>

</td></tr></table>

</asp:TabContainer>

How can i use ajax Model popup on image button click inside gridview ?

$
0
0

I need the model popup control  when ever detail button  i.e an image button inside gridview is clicked ,for that i did:

<table class="tbsurvey"><tr><td colspan="3" class="tdheader"> &nbsp;</td></tr><tr><td></td></tr><tr><td>&nbsp;&nbsp;<asp:Label ID="lblwebsector" runat="server" Text='<%#Eval("webSecName")%>'></asp:Label></td></tr><tr><td><asp:Panel ID="plgrid" runat="server"><div class="plsection"><asp:GridView ID="gridQuestion" runat="server" AutoGenerateColumns="False"
        CellPadding="4" ForeColor="#333333" GridLines="None" Width="815px"
        DataKeyNames="FKSectionID"
        onpageindexchanging="gridQuestion_PageIndexChanging" AllowPaging="True"
        PageSize="3" onrowcommand="gridQuestion_RowCommand" ><AlternatingRowStyle BackColor="White" ForeColor="#284775" /><Columns><asp:TemplateField HeaderText="S.no" ItemStyle-VerticalAlign="Top"  ControlStyle-Width="5px"><ItemTemplate>
        Section&nbsp;#&nbsp;<%#Container.DataItemIndex+1 %></ItemTemplate><ControlStyle Width="5px" /><ItemStyle VerticalAlign="Top" /></asp:TemplateField><asp:BoundField HeaderText="Section" DataField="sectioName" /><asp:BoundField HeaderText="No Of Questions" DataField="noOfQuestion" /><asp:TemplateField><ItemTemplate><asp:ImageButton ID="btnSection33" runat="server" CausesValidation="false" CommandArgument='<%#Eval("FKSectionID")%>' CommandName="selectSection" ToolTip="Select Section" height="20px" Width="20px" ImageUrl="~/images/survey/select2.png" onclick="btnSection33_Click" /></ItemTemplate></asp:TemplateField><asp:TemplateField><ItemTemplate><asp:HiddenField ID="hdsection" runat="server" Value='<%#Eval("FKSectionID")%>' /></ItemTemplate></asp:TemplateField><asp:ButtonField Text="Button"  /></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#009900" Font-Bold="True" ForeColor="White"
            Font-Size="14px" HorizontalAlign="Left" VerticalAlign="Middle" /><PagerStyle BackColor="#333333" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" Font-Size="13px"
            HorizontalAlign="Left" VerticalAlign="Middle" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /><SortedAscendingCellStyle BackColor="#E9E7E2" /><SortedAscendingHeaderStyle BackColor="#506C8C" /><SortedDescendingCellStyle BackColor="#FFFDF8" /><SortedDescendingHeaderStyle BackColor="#6F8DAE" /></asp:GridView></div></asp:Panel></td></tr><tr><td></td></tr><tr><td><asp:ModalPopupExtender
ID="ModalPopupExtender1" runat="server"
CancelControlID="imgClose"
DropShadow="True"
PopupControlID="plquestion"
TargetControlID="btnSelect"></asp:ModalPopupExtender><asp:Panel ID="plquestion" runat="server" Width="813px"><div><asp:ImageButton ID="imgClose" runat="server"
ImageUrl="~/images/register/cross.png"
ToolTip="Exit Questions of the Sections" /></div><div class="plquestion"></div></asp:Panel></td></tr><tr><td><asp:Button ID="btnSaveSurvey" runat="server" Text="Save" CssClass="btnsubmitsurvey" onclick="btnSaveSurvey_Click" /><asp:Button ID="btnsubmit" runat="server" Text="Submit" CssClass="btnsubmitsurvey" onclick="btnsubmit_Click" /><br /></td></tr></table>

ERROR :

Server Error in '/' Application.


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

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The TargetControlID of 'ModalPopupExtender1' is not valid. A control with ID 'btnSection33' could not be found.

What to do ?



RadRating on click

$
0
0

Hi, 

how do i put RadRating in the ReadOnly mode when clicked once. the same person should not click on the radrating twice. thank you. 

<telerik:RadRating ID="ratingBar" runat="server" AutoPostBack="True"
            ItemCount="6" OnRate="RadRating1_Rate" Orientation="Horizontal" Precision="Item"
            Skin="Outlook" Width="100px"></telerik:RadRating>



Keeping Modal Popup Visible

$
0
0

Newbie - using Visual Studio 2010 C#. 

Currently have a working ModalPopupExtender and detail panel popup - all in a gridview ItemTemplate linkbutton.  I am showing the modal popup from the gridview_RowCommand in the code behind (modalHandle.Show()). 

User enters data on the popup panel and clicks the SAVE button.  When the modal popup panel SAVE button is clicked - I am editing the panel fields in the code behind SAVEbutton_Click event and showing validation exception messages using ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Alert", errMessage, true);

However, when the alert message displays - the modal popup panel closes.  I need to keep the modal popup window visible so that the user can close the alert and fix data entry errors - and then click SAVE again until all validations pass.  I am happy to read any posts that already address this, and/or provide actual code snippets.  Thanks in advance.

 

Viewing all 5678 articles
Browse latest View live


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