Showing posts with label drop. Show all posts
Showing posts with label drop. Show all posts

Wednesday, March 28, 2012

ProfileScriptService not sticking

Is there something I'm missing. I get the drag and drop to work but I cannot get the profile setting to save. It resets the setting on a postback.

Did you try to use Fiddler or Nikhil's browser helper to monitor the exchanges with the profile service and see if there's an error message there?

programatically disable dropdown in Ajax updatepanel

I've searched high and low for what seemed would be a simple and frequently used method to access the properties of a drop down contained in a Ajax UpdatePanel without finding anyone who seems to have needed to do this or who has solved it. Maybe Microsoft decided nobody would ever want to do such a weird thing!

I have users with various permission levels. Depending on their level, on page load I need to disable drop downs which are contained within Ajax Updatepanels.

I can expose the properties of the UpdatePanels themselves but they do not support the enable property, only invisible which is no help.

Anyone know how this is done ?

Thanks

Aren't you able to just set the Enabled property of the appropriate DropDownList's?


Dont depends only on UI elements enable/disable state. Also enusre the User level in server side. Can pls post some code i mean in which point you want to disable the dropdown list.

Use CascadingDropDown control in AJAXControlToolKit

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/CascadingDropDown/CascadingDropDown.aspx


Hi,

Are you using the AJAX extension version 1.0.61025.0 ?

I'm using this one. The controls inside UpdatePanel can be accessed directly. For instance:

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void Page_Load(object sender, EventArgs e) { DropDownList1.Enabled = false; }</script><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:DropDownList ID="DropDownList1" runat="server"> </asp:DropDownList> </ContentTemplate> </asp:UpdatePanel> </div> </form></body></html>

Monday, March 26, 2012

proplem with add ajax control

dir sair

when i add any ajax control in wesite using ajax template i cant using prifix ajaxtoolkit

i must drag and drop the control and his prifix will be cc:

ex: cc1:modelpopupextender

can i know whay?

thank you

here cc1:modelpopupextender means customControl:modelpopupextender

u have to register the AjaxToolKitControl

<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

this line apperd on top of head section like Page

then u can drag and drop the control

that time it will generate ajaxToolkit: modelpopupextender

Thank

Kunal


Hi,

Another tip is that you can register it in web.config so that don't have to do it in everypage.

<system.web>
<pages>
<controls>
<add assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"tagPrefix="ajaxToolkit"/>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>

Hope this helps.

public CascadingDropDownNameValue[] GetAllDistrict(string knownCategoryValues, string cate

want to know whether i can pass more than two arguments in the above shown webservice method..i intend to implement it in a cascading drop down list.. having two sibling dropdown lists...

so i want to pass three arguments eg..cid, brid, deptid...but a webservice allows only two of the kind...

Hi,

You can pass more information via a third parameter contextKey. For instance:

public static AjaxControlToolkit.CascadingDropDownNameValue[]
GetDropDownContentsPageMethod(string knownCategoryValues, string category, string contextKey)

protected void Page_Load(object sender, EventArgs e)
{
CascadingDropDown2.ContextKey = "contextKeyOf2";
}

Hope this helps.

Saturday, March 24, 2012

Query regarding Ajax Atlas Tool Kit Cascading Dropdown List


Hi All,
I am using ajax atlas tool kit in my project.
Is it possible to share a parent cascading drop down with two child cascading dropdown list??
if any one has come across such logic or have any idea regarding this, pls help me.
Thanks in advance


Regards,
Palavesh

Hi,

I think you should try it by yourself before you ask!

Anyway,I found this question is answered by Jonathan Shen – MSFT athttp://forums.asp.net/t/1183703.aspx

Regards,


Hi,

Thank you. Jonathan shen's reply was for my post only. I have gone through the post.

Regards,

Palavesh

Query regarding Ajax Atlas Tool Kit Cascading Dropdown List

Hi All, I am using ajax atlas tool kit in my project.Is it possible to share a parent cascading drop down with two child cascading dropdown list??if any one has come across such logic or have any idea regarding this, pls help me.Thanks in advance

Hi Palavesh,

Of course. You can do it like this.

State:<asp:DropDownList runat="server" ID="dlState">
</asp:DropDownList>
City:
<asp:DropDownList runat="server" ID="dlCity" >
</asp:DropDownList>
District:
<asp:DropDownList runat="server" ID="dlDistrict">
</asp:DropDownList>
<cc1:CascadingDropDown ID="CascadingDropDown1" BehaviorID="myCDEState" runat="server" TargetControlID="dlState"
Category="State" ServicePath="../WebService/CityServiceOledb.asmx" ServiceMethod="GetStates" LoadingText="[Loading...]" PromptText="Please select state">
</cc1:CascadingDropDown>
<cc1:CascadingDropDown ID="CascadingDropDown2" BehaviorID="myCDECity" runat="server"TargetControlID="dlCity" ParentControlID="dlState"
Category="City"
PromptText="Select a city" ServicePath="../WebService/CityServiceOledb.asmx"
ServiceMethod="GetCities" LoadingText="Load cities..." >
</cc1:CascadingDropDown>
<cc1:CascadingDropDown ID="CascadingDropDown3" BehaviorID="myCDDistrict" runat="server"TargetControlID="dlDistrict" ParentControlID="dlState"
Category="District" PromptText="Select a district" ServicePath="../WebService/CityServiceOledb.asmx"
ServiceMethod="GetDistricts" LoadingText="Load districts..." >
</cc1:CascadingDropDown>

I hope this help.

Best regards,

Jonathan


Hi Jonathan,

Thank you.. I hope this will solve my issue.

Regards,

Palavesh.


Hi Palavesh,

You are welcome. Big Smile If it doesn't work , please feel free to let me know.

Best regards,

Jonathan


Hi jonathan,

i have below piece of code in my project.

i need source and locality from the city selected ,

initially it works fine during the the selection of city,

after i submit the form (during postback) locality dropdown is not populated,

can you pls give me your suggestion

thanks in advance

<%@. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="cc1" %>

<asp:DropDownList ID="Dlstate" runat="server" />

<asp:DropDownList ID="DlCity" runat="server">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cascadingstatezonecity" runat="server">
<cc1:CascadingDropDownProperties Category="StateName" ParentControlID="Dlstate"
TargetControlID="DlCity" PromptText="Select City" ServiceMethod="Pros_GetCityByStateID"
ServicePath="venusStateLocality.asmx" />
</cc1:CascadingDropDown>

<asp:DropDownList ID="DlLocality" runat="server" />
<cc1:CascadingDropDown ID="cascadingstatezonelocality" runat="server">
<cc1:CascadingDropDownProperties Category="CityName" ParentControlID="DlCity"
TargetControlID="DlLocality" PromptText="Select Locality" ServiceMethod="Pros_GetLocalityByCityID"
ServicePath="venusStateLocality.asmx" />
</cc1:CascadingDropDown>

<asp:DropDownList ID="DlSource" runat="server">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cascadingstatesource" runat="server">
<cc1:CascadingDropDownProperties Category="CityName" ParentControlID="DlCity"
TargetControlID="DlSource" PromptText="Select Source" ServiceMethod="Pros_GetSourceByCityID"
ServicePath="venusStateLocality.asmx" />
</cc1:CascadingDropDown>


Hi Palavesh,

You have four CascadingDropDowns on the page, I suggest that you should add a CascadingDropDown for Dlstate. To debug it , please reference to thisthread.

Best regards,

Jonathan

Wednesday, March 21, 2012

Question on Drag/Drop - Can you intercept the X/Y coordinates for alternate saving?

I want to grab to X/Y coordinates and save them someplace other than the Profile database. Is there an eventarg description that shows the eventargs for the DragDrop control?

Thanks!

I am after the exact same information as I need to have one user with several layouts. Did you come across this information in the end? Or alternativley is someone able to offer any advice/examples.

Many thanks

Mark

Question: Using CascadingDropDown with OleDb

I'm curious. Do youhave to use a Web Service when trying to pull items for a cascading drop down from a database or is there another (perhaps simpler) way? I'd love to be more enlightened on the subject. Thanks in advance.

Hi Venom,

VenomZ302:

Using CascadingDropDown with OleDb

I have made a sample. Hope it helps.

ASPX:

<%@. Page Language="C#" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> State:<asp:DropDownList runat="server" ID="dlState"> </asp:DropDownList> City: <asp:DropDownList runat="server" ID="dlCity"> </asp:DropDownList> <cc1:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="dlState" Category="State" PromptText="Select a state" ServicePath="../WebService/CityServiceOledb.asmx" ServiceMethod="GetStates" LoadingText="Load Text..."> </cc1:CascadingDropDown> <cc1:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="dlCity" ParentControlID="dlState" Category="City" PromptText="Select a city" ServicePath="../WebService/CityServiceOledb.asmx" ServiceMethod="GetCities" LoadingText="Load Text..."> </cc1:CascadingDropDown> </form></body></html>

WebService:

<%@. WebService Language="C#" Class="CityServiceOledb" %>

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Collections.Specialized;
using System.Collections.Generic;
using AjaxControlToolkit;
using System.Data.OleDb;
using System.Web.Script.Services;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class CityServiceOledb : System.Web.Services.WebService {

protected OleDbConnection cn;
protected OleDbCommand cm;
protected OleDbDataReader myReader;
private string strSql = "";
//private string conStr = "data source=TASKONE\\SQLEXPRESS;initial catalog=TestDB;user id=sa;pwd=password;Pooling=True; Min Pool Size=0; Max Pool Size=1000; Connection Lifetime=30;";

//private string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\MyWork\\DB\\YourDBName.mdb";
//using Microsoft Office2007
private string conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\MyWork\\DB\\Database1.accdb";
public CityServiceOledb() { }

[WebMethod]
public CascadingDropDownNameValue[] GetStates(string knownCategoryValues, string category)
{
strSql = "SELECT * FROM tb_State";
GetDr(strSql);
List<CascadingDropDownNameValue> myList = new List<CascadingDropDownNameValue>();
while (myReader.Read()) {
myList.Add(new CascadingDropDownNameValue(myReader["StateName"].ToString(), myReader["StateID"].ToString()));
}
myReader.Close();
return myList.ToArray();
}
[WebMethod]
public CascadingDropDownNameValue[] GetCities(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int stateID;
if (!kv.ContainsKey("State") || !Int32.TryParse(kv["State"], out stateID))
{
return null;
}
List<CascadingDropDownNameValue> myList = new List<CascadingDropDownNameValue>();
strSql = "SELECT * FROM tb_City WHERE StateID=" + stateID.ToString();

GetDr(strSql);
while (myReader.Read())
{
myList.Add(new CascadingDropDownNameValue(myReader["CityName"].ToString(), myReader["CityID"].ToString()));
}
myReader.Close();
return myList.ToArray();
}

#region DB Operate
public void Open()
{
if (cn == null)
{
cn = new OleDbConnection(conStr);
cn.Open();
}
}
public void Close() {
if (cn != null)
{
cn.Close();
cn = null;
}
}

public OleDbDataReader GetDr(string strSql) {
Open();
cm = new OleDbCommand(strSql,cn);
myReader = cm.ExecuteReader();
//myReader = cm.ExecuteReader();
return myReader;
}
#endregion DBOperate

}

Note: You should add two tables with the name "tb_State" and "tb_City" into your Database ,which is used in your project , before you using this demo.

Table "tb_State" has two fields with the name "StateID"(primarykey) and "StateName"(Text).

Table "tb_City" has three fields with the name "CityID"(primarykey)、"StateID"(Number) and "CityName"(Text).

VenomZ302:

I'm curious. Do youhave to use a Web Service when trying to pull items for a cascading drop down from a database or is there another (perhaps simpler) way? I'd love to be more enlightened on the subject. Thanks in advance.

We are not limited to use Web Service. Sometimes, we may add the implement code into our *.cs file directly. Here is the sample:

using System;using System.Web.Services;using AjaxControlToolkit;public partialclass CascadingDropDown_CascadingDropDown : CommonPage{protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e) {// Get selected values } [WebMethod] [System.Web.Script.Services.ScriptMethod]public static CascadingDropDownNameValue[] GetDropDownContentsPageMethod(string knownCategoryValues,string category) {
 //obtain data from Database.
 return;
 }}
Note: We needn't to set the ServicePath property for the control in this case. Just like below.
<ajaxToolkit:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="DropDownList2"
Category="Model" PromptText="Please select a model" LoadingText="[Loading models...]"
ServiceMethod="GetDropDownContentsPageMethod" ParentControlID="DropDownList1" />
Details please dip into the Ajax ControlToolkit source code.

If I misunderstood you, please let me know.


Thanks for the information. I really appreciate it. Now, however, I've progressed to the point where I need to understand more of the error codes that are given. Most specifically, error 12030, as found in my thread here: http://forums.asp.net/t/1138732.aspx

Thanks again.


Hi Venom,

Error code: 12030

ERROR_INTERNET_CONNECTION_ABORTED
The connection with the server has been terminated.

In your case, it seems like your webservice doesn't work properly.I suggest that you should add break points into your webservice and debug step-by-step.

Note: If you made some modifications in your webservice and before you debug , please reset your aplication by saving your web.config file.Good luck! Big Smile