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

Tabcontainer issue

$
0
0

Hi

I am using a Ajax Tabcontainer in my application.

<asp:TabContainer ID="tabconta1" runat="server" OnDemand="true" TabStripPlacement="Top"
        ScrollBars="None" AutoPostBack="false" ActiveTabIndex="0">
        <asp:TabPanel ID="tabpan1" runat="server" Enabled="true" HeaderText="tab1"
            OnDemandMode="Always">
            <ContentTemplate>
                <asp:Panel ID="pnlgrid1" runat="server">
                    <uc2:Usercontrolgrid ID="grid1" runat="server" EnableViewState="true">
                    </uc2:InvCompGrid>
                </asp:Panel>
                <asp:Panel ID="pnlmsg1" runat="server">
                   some text here
                </asp:Panel>
            </ContentTemplate>
        </asp:TabPanel>
        <asp:TabPanel ID="tabpan2" runat="server" Enabled="true" HeaderText="tab2" OnDemandMode="Always">
            <ContentTemplate>
                <asp:Panel ID="pnlgrid2" runat="server">
                     <uc2:Usercontrolgrid ID="grid2" runat="server" EnableViewState="true">
                    </uc2:InvCompGrid>
                </asp:Panel>
                <asp:Panel ID="pnlmsg2" runat="server">
                   some text here
                </asp:Panel>
            </ContentTemplate>
        </asp:TabPanel>
        <asp:TabPanel ID="tabpan3" runat="server" Enabled="true" HeaderText="tab3" OnDemandMode="Always">
            <ContentTemplate>
                <asp:Panel ID="pnlgrid3" runat="server">
                  <uc2:Usercontrolgrid ID="grid3" runat="server" EnableViewState="true">
                    </uc2:InvCompGrid>
                </asp:Panel>
                <asp:Panel ID="pnlmsg3" runat="server">
                   some text here
                </asp:Panel>
            </ContentTemplate>
        </asp:TabPanel>
    </asp:TabContainer>


Now the page work like

if  in tabpanel1 if  pnlgrid1 is visible then pnlmsg1 visible will be false. this will be same for the remaining tabpanels.

if  in tabpanel2 if  pnlgrid2 is visible then pnlmsg2 visible will be false. this will be same for the remaining tabpanels.

if  in tabpanel3 if  pnlgrid3 is visible then pnlmsg3 visible will be false. this will be same for the remaining tabpanels.

so when page is loaded, any one of the control will be visible in each tabpanel.

whenever usercontrol is visible then the remaining controls in another tabpanel is not getting visible. and if no user control in any tabpanel is visible then the tabcontainer is working according to the requirement. i.e pnlmsg1, pnlmsg2, pnlmsg3 are visible in each tabpanel.

Then my issue is why the controls in other tabpanels are not getting visible if usercontrol is getting visible. 

Plz suggest me a way to resolve...

Thanks in advance


AjaxFileUpload not firing UploadComplete event on server

$
0
0

I have a simple form where I want to upload some files and save them on then save them on the server when the UploadComplete event fires. I can not get the event to fire no matter what I do. I've viewed innumerable postings on this issue as others have the same problem, and yet none of the fixes seem to work for me. I am using the latest version of the toolkit, 4.1.60623.

I have updated the form with this:

    <form name="frmProcess" runat="server" enctype="multipart/form-data" method="post">

I found one posting that said to add this code to the control and someone claimed that it worked.

    onuploadedcomplete="uploadExcelFile_UploadComplete"

(the name of the server side event procedure) which I've tried without success.


Any other ideas?

How to set a range of dates to be enabled in Ajax Calendar Extender

$
0
0

Hello Everyone,

I need help on above mentioned topic. Actually i need to enable the dates for only next 15 days and rest of the days should be disabled in the Ajax calendar extender.

I tried a lot to find a solution but unfortunatly i did not any proper solution.

Please help me on this.

Thanks in advance.

HttpException Multiple controls with the same ID 'ctrl0' were found

$
0
0

Hi all,

I am getting the following error in my website randomly.

Exception:

Exception information: 
    Exception type: HttpException 
    Exception message: Multiple controls with the same ID 'ctrl0' were found. FindControl requires that controls have unique IDs. 

Stack Trace:

 Stack trace:    at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)
   at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)
   at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)
   at System.Web.UI.Control.EnsureNamedControlsTable()
   at System.Web.UI.Control.FindControl(String id, Int32 pathOffset)
   at System.Web.UI.Control.FindControl(String id, Int32 pathOffset)
   at System.Web.UI.Control.FindControl(String id)
   at AjaxControlToolkit.ExtenderControlBase.FindControlHelper(String id)
   at AjaxControlToolkit.ExtenderControlBase.FindControl(String id)
   at System.Web.UI.ExtenderControl.RegisterWithScriptManager()
   at System.Web.UI.ExtenderControl.OnPreRender(EventArgs e)
   at AjaxControlToolkit.ExtenderControlBase.OnPreRender(EventArgs e)
   at AjaxControlToolkit.HoverMenuExtender.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

It seems to be that this error occurs while pre-render happens in HoverMenuExtender(I judged this by seeing the stack trace).

dynamic htmleditor extender problem

$
0
0

Hi

I am creating an htmleditor extender dynamically. However if the multiline textbox contains a line break then NONE of the data is saved, just a blank string.

 

If not created dynamicaly then this is not an issue, how ever I need to create it dynaimcally.

Her is the code generating the htmlextender.

This is driving me nuts, can anyone get a dynamically added htmlextender to work? Thanks

 

 

Private Function setHtmlExtenderControlId(ByVal intTicketFieldId) As AjaxControlToolkit.HtmlEditorExtender

       

Dim ext As New AjaxControlToolkit.HtmlEditorExtender()

        ext.ID =

"ext" & intTicketFieldId.ToString

       

Dim buttons As AjaxControlToolkit.HtmlEditorExtenderButtonCollection = ext.Toolbar

        buttons.Add(

New AjaxControlToolkit.Undo())

        buttons.Add(

New AjaxControlToolkit.Redo())

        buttons.Add(

New AjaxControlToolkit.HorizontalSeparator())

        buttons.Add(

New AjaxControlToolkit.Bold())

        buttons.Add(

New AjaxControlToolkit.Italic())

        buttons.Add(

New AjaxControlToolkit.Underline())

        buttons.Add(

New AjaxControlToolkit.HorizontalSeparator())

        buttons.Add(

New AjaxControlToolkit.InsertOrderedList())

        buttons.Add(

New AjaxControlToolkit.InsertUnorderedList())

        buttons.Add(

New AjaxControlToolkit.HorizontalSeparator())

        buttons.Add(

New AjaxControlToolkit.FontNameSelector())

        buttons.Add(

New AjaxControlToolkit.FontSizeSelector())

        buttons.Add(

New AjaxControlToolkit.ForeColorSelector())

        buttons.Add(

New AjaxControlToolkit.HorizontalSeparator())

        buttons.Add(

New AjaxControlToolkit.InsertImage())

       

AddHandler ext.ImageUploadComplete, AddressOf MyHtmlEditorExtender_ImageUploadComplete

        ext.EnableSanitization =

True

        ext.TargetControlID = intTicketFieldId

        ext.EnableViewState =

True

        ext.Enabled =

True

        ext.EnsureValid()

        ext.ViewStateMode = System.Web.UI.

ViewStateMode.Inherit

        ext.ClientIDMode = System.Web.UI.

ClientIDMode.Inherit

        setImageUploadFileTypes(ext)

       

Return (ext)

   

End Function

AjaxFileUpload Help

$
0
0
<asp:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server" />
        <asp:AjaxFileUpload ID="AjaxFileUpload2" runat="server" 
            onuploadcomplete="AjaxFileUpload2_UploadComplete" />
    protected void AjaxFileUpload2_UploadComplete(object sender, AjaxFileUploadEventArgs e)
    {
        string path = MapPath("~/DemoFolder/Images/") + e.FileName;
        AjaxFileUpload2.SaveAs(path);
    }

It's not saving... I realized the string e.FileName gets C:\\Image\\1.jpg

Unknown

asyncfileupload not firing uploadcomplete server event Please help

$
0
0

Step two in my create user wizard adds images to system using the asycfileupload control. When I set the activesetupindex to step two for testing everything works and the uploadcomplete event is called.

when i remove the activestepindex the wizard navigates normally but when I get to step two the asynfileupload does not fire the uploadComplete event. Not sure what may be causing it


Hide modalpopupextender inside usercontrol

$
0
0

Hi All,

I have modalpopupextender in updatepanel which is in usercontrol.

<asp:ModalPopupExtender ID="mpeConfirmNames" runat="server" TargetControlID="hlPopName" 
    PopupControlID="pnlConfirmNames" BackgroundCssClass="modalBackground" CancelControlID="btnConfirmNamesCancel" /> 
<asp:Panel ID="pnlConfirmNames" runat="server" Style="text-align: left; width: 450px; 
    background-color: #EFF3FB; border-width: 2px; border-color: gray; border-style: solid; 
    padding: 10px;"> 
    Please confirm that First and Last names are spelt as they appear on your Passport 
    as name correction fees may apply or you may be denied boarding. 
    <br /> 
    <br /> 
    <asp:Label ID="lblTest" runat="server" /> 
    <div align="center" id="grdUser"> 
        <asp:GridView ID="UserGridView" runat="server" AutoGenerateColumns="False" Width="90%"> 
            <HeaderStyle BackColor="#BFE2F9" Font-Bold="true" Font-Size="12px" ForeColor="#000000" /> 
            <Columns> 
                <asp:BoundField HeaderText="First Name" DataField="Firstname" /> 
                <asp:BoundField HeaderText="Middle Name" DataField="Midname" /> 
                <asp:BoundField HeaderText="Last Name" DataField="Lastname" /> 
                <asp:TemplateField HeaderText="DOB"> 
                    <ItemTemplate> 
                        <%# Eval("Day") + "/" + Eval("Month") + "/" + Eval("Year")%> 
                    </ItemTemplate> 
                </asp:TemplateField> 
            </Columns> 
        </asp:GridView> 
    </div> 
    <asp:Label ID="lblUserName" runat="server" /> 
    <div style="text-align: center;"> 
        <asp:Button ID="btnConfirmNamesCancel" runat="server" Text="Change" TabIndex="0" 
            OnClick="btnConfirmNamesCancel_Click" /> 
        &nbsp;&nbsp; 
        <asp:Button ID="btnConfirmNamesOK" runat="server" Text="Confirm" TabISndex="1" OnClick="btnConfirmNamesOK_Click" /> 
    </div> 
</asp:Panel> 
<asp:Button ID="hlPopName" runat="server" Visible="false" />

LoadSummary() takes few seconds to process so I want to disable button(btnConfirmNamesOK) Or hide the modalpopupextender.

I have tried codebehind

 protected void btnConfirmNamesOK_Click(object sender, EventArgs e)
        {            
            mpeConfirmNames.Hide();
            LoadSummary();
        }        

also tried

Javascript to disable button but didn't work!

    function disableButton() {
        var arrInputs = document.getElementById('<%= btnConfirmNamesOK.ClientID%>');
        arrInputs.disabled = true
    } 

 <asp:Button ID="btnConfirmNamesOK" runat="server" Text="Confirm" TabISndex="1" OnClick="btnConfirmNamesOK_Click" OnClientClick="window.setTimeout('disableButton()',0); return true" Text="OK"/>

Best Regards,

Damodar 

Help on UpdateProgrss

$
0
0

Hi,

I have an update panel on my page..and an associated UpdateProgess also...

I want to show the update progress on Click of a button that is not there in the update panel....

can any one please help me with this.......

ModalPopup throwing Microsoft JScript runtime error: Unable to get value of the property 'click': object is null or undefined when refresh the page

$
0
0

I have this code

<asp:LinkButton ID="LinkButton1" runat="server" Text="LinkButton" />
<asp:DragPanelExtender ID="DPE1" runat="server" DragHandleID="pnl1" TargetControlID="Panel1" />
<asp:Panel ID="Panel1" runat="server" Style="display: none; background-color: White;">
<asp:Panel ID="pnl1" runat="server">
<table style="background-color: AppWorkspace;">
<tr>
<td align="center">
<asp:Label ID="lblHeader" runat="server" Text="Header testing" ForeColor="White" />
</td>
<td align="right">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ImageButton ID="CancelButton1" runat="server" CausesValidation="False" Height="20px"
ToolTip="Close" AlternateText="Close" ImageUrl="~/images/close.jpg" OnClick="CancelButton1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="pnl2" runat="server">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
Ipsum has been the industry's standard dummy text ever since the 1500s,
</p>
<asp:Button ID="btn" runat="server" Text="test" OnClick="btn_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
</asp:Panel>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="modalbackground"
PopupControlID="Panel1" TargetControlID="LinkButton1" PopupDragHandleControlID="DPE1"
CancelControlID="CancelButton1" Drag="true" />
<asp:Label ID="lbl" runat="server" />

I am getting the above exception when I click the CancelButton1 after the test button 

Why? and how to resolve this issue?

Thanks in advance for any help

Linkbutton in gridview inside updatepanel not clickable in Firefox/Chrome

$
0
0

Hi

I have the below Updatepanel with first column a linkbutton which should call a modal popup. However in firefox/chrome no lick is clickable on page

 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>
    <asp:GridView ID="GridView1" runat="server" 
        AutoGenerateColumns="False" 
        DataSourceID="OrderList" DataKeyNames="PurchaseID" >
    <Columns>
        <asp:TemplateField HeaderText="Purchase ID">
            <ItemTemplate>
                <asp:LinkButton ID="btnPurchaseDetail" runat="server" Text='<%#Eval("PurchaseID") %>' OnClick="btnPurchaseDetail_Click" CausesValidation="false" />
            </ItemTemplate>
        </asp:TemplateField>
  
        <asp:BoundField DataField="Name" HeaderText="Name" />
        <asp:BoundField DataField="Address" HeaderText="Address" />
        <asp:BoundField DataField="Country" HeaderText="Country" />
        <asp:BoundField DataField="HomePhone" HeaderText="HomePhone" />
        <asp:BoundField DataField="Email" HeaderText="Email" />
        <asp:TemplateField HeaderText="Shipped" SortExpression="Shipped">
          <%--  <EditItemTemplate>
                <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Shipped") %>' />
            </EditItemTemplate>--%>
            <ItemTemplate>
                <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Shipped") %>' 
                    Enabled="false" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField >            
            <FooterTemplate>
               <%-- <asp:LinkButton ID="btnEdit" runat="server" CommandName="Edit" Text="Edit" />--%>
            </FooterTemplate>
        </asp:TemplateField>

    </Columns>
    </asp:GridView>
    <asp:Button runat="server" ID="btnModalPopUp" Style="display: none" />
     <asp:ModalPopupExtender TargetControlID="btnModalPopUp" 
        ID="ModalPopupExtender2" runat="server"
        BackgroundCssClass="modalBackground"
        PopupControlID="divPopUp" 
        PopupDragHandleControlID="panelDragHandle"
        DropShadow="true"
        OkControlID="btnOKModalPopup"
        CancelControlID="btnCancelModalPopup" />
    <div class="popUpStyle" id="divPopUp" style="display:none;">
    <asp:Panel ID="UpdatePanel2" runat="server" CssClass="drag">
            <asp:Label ID="lblPurchaseID" runat="server"></asp:Label>
            <asp:GridView ID="GridView2" runat="server">
            </asp:GridView>                         
            <asp:Button ID="btnClose" runat="server" Text="Close" />
      
     </asp:Panel>
    </ContentTemplate>
    </asp:UpdatePanel> 


    <asp:SqlDataSource ID="OrderList" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        
        SelectCommand="SELECT Purchase.PurchaseID, Customer.Name, Customer.Address, Customer.HomePhone, Customer.Email, Customer.Country, Purchase.Shipped FROM Purchase INNER JOIN Customer ON Purchase.CustomerID = Customer.CustomerID WHERE (Purchase.Shipped <> 'True')">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="OrderDetails" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        
        SelectCommand="SELECT Purchase_Detail.PurchaseID, Product.ProductName, Product.Description, Product.Price FROM Purchase_Detail INNER JOIN Product ON Purchase_Detail.ProductID = Product.ProductID WHERE (Purchase_Detail.PurchaseID = @PurchaseID)">
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" Name="PurchaseID" 
                PropertyName="SelectedValue" />
        </SelectParameters>
    </asp:SqlDataSource>

The associated function in codebehind is 

Protected Sub btnPurchaseDetail_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim lb As LinkButton = TryCast(sender, LinkButton)
        Dim PurchaseID As String = lb.Text
        'lblCustValue.Text = custID
        ' Connection
        Dim constr As String = System.Web.Configuration.WebConfigurationManager.
        ConnectionStrings("ConnectionString").ConnectionString
        Dim sql As String = "SELECT Purchase_Detail.PurchaseID, Product.ProductName, Product.Description, Product.Price FROM Purchase_Detail INNER JOIN Product ON Purchase_Detail.ProductID = Product.ProductID WHERE (Purchase_Detail.PurchaseID = @PurchaseID)"
        Dim connection As New SqlConnection(constr)
        Dim cmd As New SqlCommand(sql, connection)
        cmd.Parameters.AddWithValue("@PurchaseID", PurchaseID)
        cmd.CommandType = CommandType.Text
        connection.Open()
        Dim dr As SqlDataReader = cmd.ExecuteReader()
        ' Bind the reader to the GridView
        ' You can also use a lighter control
        ' like the Repeater to display data
        GridView2.DataSource = dr
        GridView2.DataBind()
        connection.Close()
        ' Show the modalpopupextender
        ModalPopupExtender2.Show()

    End Sub

However the column is not clickable in firefox/chrome, but it is in IE.

When I look at one of the cells in firebug it appears to be rendering as a link

<a href="javascript:__doPostBack('ctl00$Head$GridView1$ctl02$btnPurchaseDetail','')" id="Head_GridView1_btnPurchaseDetail_0">41</a>

Any ideas as i've ben searching around but no solutions i found appeared to help?



ComboBox Dropdown Button swallows first key

$
0
0

 

If you click on the dropdown arrow of a ComboBox and then type a letter, that first letter is ignored in the search. Has anyone already worked around this?

Here is a repro:

I looked through the JS and sure enough it is just setting focus to the textbox on the first key press. Before I start messing around in there I was wondering if someone had already tweaked this behavior?

 

UpdateProgress spinner won't stop!!

$
0
0

hi

I have an UpdateProgress AJAX spinner which works ok when any updates occur within my UpdatePanel.

However I have an export button which carries out into excel. when the prompt save or cancel appear then i choose save the spinner doesnt stop at all.. can anyone help me.. how to stop the spinner of my progress stop if the excel is finished to export.

AsyncFileUpload Control not working in Update Panel

$
0
0

I have a update panel which contain the AsyncFileUpload Control. when i choose any image first time with out fire any event in update panel then this control not working. but once update panel fire any event then this control start working properly can any buddy help me in solving this problem.


Modal Popup Extender With Different Popup Control id

$
0
0

Hi All,

I have stuck in a problem and i am working on this last 10 days but i din't get any optimal solution . please help me out.

Problem:

I have an aspx page with one dropdownlist, one hyperlink, one modal popup extender and 4 user control registered on aspx page.
On the basis of selected value of dropdownlist i have to show one user control from 4 user controls at a time as modal popup. On modal popup on click of OK button i want to return a List<Generic> data source to my parent page.

But i am not able to change the popup control id of modal popup at run time i.e. by server side code.

Please suggest me how can i achive thisOR any other way to do the same thing, it would be very helpful for me.
Its very urgent for me.

TIA.

Avinash

Word to HTMl Conversion

$
0
0

Hi All,

  How to convert word file to html with formating tag in ASP.Net, its urgent please help me

ScriptManager is ambiguous

$
0
0

Hi,

I am using VS2005.I installed Microsoft ASP.Net 2.0 Ajax Extensions 1.0 to make use of script manager and Update panel.It works fine on my local machine but throws the following error when i hosted it on a different server.I tried many different solutions for this available on the net but nothing seems to work.Any help is appreciated as its very urgent.Thanks in advance..

The following is the error , i am using asp.net 2005

-------------------------------------------------------

The server tag 'asp:ScriptManager' is ambiguous. Please modify the associated registration that is causing ambiguity and pick a new tag prefix.

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

Line 4:      Namespace="System.Web.UI" TagPrefix="asp" %>

AJAX Calendar Extender Control NOT working

$
0
0

I am trying to build a Web Application using Visual Studio 2005 and C# 2005. I need to accept a date in a particular textbox. I tried to use AJAX Calendar Extender for the purpose. I have added AJAX Script Manager and CalendarExtender controls to the webpage and set the TargetControlId of CalendarExtender to the proper textbox id. But when I display the webpage (using Debug -> Start Without Debugging) and click inside the textbox nothing happens. I even tried to add an image control to the form and set the PopupButtonId of the CalendarExtender to the image, but even then I am unable to display the calendar control. What am I doing wrong??

How will an update panel help in this case?

$
0
0

UPDATE: I have tried placing the button in the update panel but nothing happens. Firebug shows that the onclick is not fired.

I am working on a website using Google maps apiv3. I have a button through which I execute some logic using code behind of button_click and a javascript function. I am able to execute all the logic well but ultimately at the end the page reloads and I end up with nothing on the map.

<asp:Button ID="Button1" runat="server" style="z-index: 1; left: 573px; top: 146px; position: absolute" 
        Text="Show route" onclick="Button1_Click1"/>

Button_Click1:

protected void Button1_Click1(object sender, EventArgs e)
{
    using (con = new MySqlConnection("server=localhost; uid=root;password=aaa;database=Gmaps"))
    da = new MySqlDataAdapter("select * from routes where uid='a1'", con);
    da.Fill(ds, "mroute");
    foreach (DataRow r in ds.Tables[0].Rows)
    {
        uroute.Add(r["latlng"].ToString());
    }
    croute = new string[uroute.Count];
    croute = uroute.ToArray();
    hdncroute.Value = string.Join("&", croute);
    ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript:droute();", true);
}

Javascript:

function droute()
{
    var route=[];
    var temp;
    temp = document.getElementById('<%= hdncroute.ClientID %>').value;
    route= temp.split('&');
    //Loop to add locations and draw line
    var path= polyline.getPath();
    for(var i=0;i<route.length;i++)
        {
            var input= route[i];
            var ltln = input.split(",",2);
            var lat=parseFloat(ltln[0]);
            var lng=parseFloat(ltln[1]);
            var pos= new google.maps.LatLng(lat,lng);
            var marker= new google.maps.Marker({position:pos,map:map});
            path.push(route[i]);
            google.maps.event.addListener(marker,'click',showiwindow);
        }
    function showiwindow(event)
    {
    iwindow.setContent("<b>Coordinates are:</b><br/>Latitude:"+event.latLng.lat()+"<br/>Longitude:"+event.latLng.lng());
    iwindow.open(map,this);
    } 
}

Not much to bother about the logic in the code since its all fine. Only thing is I need to avoid this reload.

Viewing all 5678 articles
Browse latest View live




Latest Images