|
Hi All,
Can any one tell me, how do we idenify that the database whose we are connected in a web application is MySql, SQL Express, .. etc.
Thanks in advance for solving my problem...
Brijendra
|
|
|
|
|
Hello,
I try to explain as best as I can what I'm trying to do:
1)I'm writing a web app using ASP.NET / FW 3.5 and LINQ to SQL.
2)I've got a table called Categories {id<pk>, description} and SubCategories {id<pk>,parentid<pk>, description}
3)I've got two gridview binded to the tables above with LinqDataSource (tried with a single data source and 2 different one)
Even if on db there's a relationship between Categories and SubCategories I can't find an easy way to have the second gridview (the subcategories one) binded to the first one. right now I'm doing the "binding" between the two manually, getting the selected row from first and digging to get the id, but I don't like it much, since sometimes category grid view loses the selectedrow property.
Is somewere an example or tutorial about how can I do it in the best way?
Thanks
Bests
|
|
|
|
|
Hi,
I created one dropdownlist dynamically,when i select any value in that dynamically created dropdownlist,i have to create one more dropdownlist and based on the value of first dropdown,i m going to input respective items in the second dropdown list.i have to continue the same for 2 more dropdown.
i just tried by using the following code:
list.SelectedIndexChanged += new EventHandler(list_SelectedIndexChanged);
but this event is not getting fired at all.
can anybody please help me to resolve this issue.
Regards
Vidhya
|
|
|
|
|
You should try the following ajax tool, it might apply to your situation
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/CascadingDropDown/CascadingDropDown.aspx
We are not a Code Charity
|
|
|
|
|
vidhyap wrote: I created one dropdownlist dynamically
You should be aware of how controls and it's viewstate works. How you are creating dynamic control ? If you are doing that in page_load or any other control's events, ASP.NET won't maintain viewstate for that control. AFAIK, Init is a perfect place for creating dynamic controls. If you are creating the dynamic controls inside a gridview/datagrid, this won't be a problem though.
vidhyap wrote: list.SelectedIndexChanged += new EventHandler(list_SelectedIndexChanged);
Looks fine. Have you set Autopostback=true ?
|
|
|
|
|
Hi Navaneeth,
Thanks for ur reply,I m not creating dropdownlist in page load.
I am creating dynamic dropdownlist based on the value of another dropdown list.
I can't create the dropdown in pageload because the condition is whenever user selects some value in first dropdown then only based on that value I am going to create differnt number of dropdowns.
I tried setting Autopostback=true.then also that event is not getting triggered.can you please help me to solve this issue.
Regards
Vidhya
|
|
|
|
|
vidhyap wrote: selects some value in first dropdown then only based on that value I am going to create differnt number of dropdowns.
So in that dropdowns selected index changed event you are creating another control and showing, right ? Can you post that code ?
|
|
|
|
|
what exactly I am doing is,based on selected value of first dropdownlist value,I am creating different number of dropdownlist box dynamically.
below code is for selected indexchanged for first dropdown:
protected void ddlSurveyName_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlSurveyName.SelectedItem.Text != "Select")
{
int surveyIdentity = Convert.ToInt32(ddlSurveyName.SelectedValue);
lblErrorSurveyName.Visible = false;
ISession session = NHibernateSessionManager.Instance.GetSession();
IQuery surveyAttributeQry = session.CreateQuery("from SurveyAttributeEntity se where SurveyID='" + surveyIdentity + "'");
IList surveyAttributeList = surveyAttributeQry.List();
foreach (SurveyAttributeEntity surveysAttributeEn in surveyAttributeList)
{
int surveyId = Convert.ToInt32(surveysAttributeEn.SurveyID);
int attributeId = Convert.ToInt32(surveysAttributeEn.AttributeID);
createddl(surveyId, attributeId);
}
}
else
{
lblErrorSurveyName.Visible = true;
lblErrorSurveyName.Text = Resources.VP_THAI.lblErrorSurveyName;
}
ddlExportTo.Enabled = false;
}
and later i have to check for hierarchy dropdownlist box,if it is created dynamically,based on the value of this Hierarchy dropdownlist i have to create one more dropdownlist and depending on the selected value of newly created dropdownlist i am going to create one more.
code i am using to create dynamic dropdownlist is as below:
protected void createddl(int surveyID, int attributeID)
{
ISession session = NHibernateSessionManager.Instance.GetSession();
IQuery attributeValueQry = session.CreateQuery("from MasterValueEntity mve where TypeID='" + attributeID + "'");
IList attributeValueList = attributeValueQry.List();
IQuery labelValueQry = session.CreateQuery("from MASTERTYPEEntity mte where TypeID='" + attributeID + "'");
IList labelValueList = labelValueQry.List();
IQuery hierarchyValueQry = session.CreateQuery("from HierarchyEntity hierarchentity where Level="+1);
IList hierarchyValueList = hierarchyValueQry.List();
DropDownList list = new DropDownList();
CheckBox chkAndAbove = new CheckBox();
list.Items.Add("Select");
Label label1 = new Label();
if (attributeID == 0)
{
label1.Text = "Hierarchy";
label1.Width = Unit.Percentage(60);
label1.Height = Unit.Percentage(50);
list.ID = "Hierarchy";
list.AppendDataBoundItems = true;
list.Width = Unit.Percentage(65);
list.Items[0].Text = "Select";
list.Items[0].Value = "-1";
list.Items[0].Selected = true;
list.DataValueField = "Id";
list.DataTextField = "Hname";
list.DataSource = hierarchyValueList;
list.DataBind();
list.AutoPostBack = true;
list.SelectedIndexChanged += new EventHandler(list_SelectedIndexChanged);
chkAndAbove.Text = "And Above";
}
else
{
foreach (MASTERTYPEEntity masterTypeEn in labelValueList)
{
list.ID = masterTypeEn.TypeName;
label1.Text = masterTypeEn.TypeName;
label1.Width = Unit.Percentage(60);
label1.Height = Unit.Percentage(50);
}
list.AppendDataBoundItems = true;
list.Width = Unit.Percentage(65);
list.Items[0].Text = "Select";
list.Items[0].Value = "-1";
list.Items[0].Selected = true;
list.DataValueField = "Id";
list.DataTextField = "TypeDesc";
list.DataSource = attributeValueList;
list.DataBind();
}
PlaceHolder1.Controls.Add(label1);
PlaceHolder2.Controls.Add(list);
PlaceHolder2.EnableViewState = true;
session.Close();
NHibernateSessionManager.Instance.CloseSession();
}
now can you give me any suggestion to proceed on the same.
Regards
Vidhya
|
|
|
|
|
Ok. it's a viewstate issue. Dynamic controls should be created each time when page refreshes. So Init is the best event for doing this. In init event, control's data won't be initialized, but it will be available with the Request.Form collection. So you have to read the value from there, do checking and create your controls. Keep it in mind, init event is too early in the page life cycle and you won't get values from the control's properties. Look into the Request.Form instead.
|
|
|
|
|
Hi Navaneeth,
Thanks for ur reply.hey I just want to confirm one thing in page_init method can I use Request.Form so that i can get the value of dynamically created dropdownlist and fire the selectedindexchanged event for the same.
Regards
Vidhya
|
|
|
|
|
vidhyap wrote: I just want to confirm one thing in page_init method can I use Request.Form so that i can get the value of dynamically created dropdownlist and fire the selectedindexchanged event for the same.
yes. it will do
|
|
|
|
|
Set the AutoPostBack property to true for the control (here dropdownlist) which wants to communitcate with the web server.
|
|
|
|
|
I did that,but then also that selectedIndexChanged event is not getting fired.
As Navaneeth said there is an issue with viewstate itself.i don't know how to solve this problem.
Regards
Vidhya
|
|
|
|
|
i use ajaxToolkit:modalpopupExtender in my site..its working fine on local machine...but when i upload this site on net i got this exception..
"Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The system cannot find the file specified."...so please tell me the solution..as i copied all dll.."AjaxControlToolkit.dll","System.Web.Extensions.dll","AJAXExtensionsToolbox.dll","System.Web.Extensions.Design.dll" and some other folder in bin folder.....please help me
|
|
|
|
|
Have you added it to your toolbar in visual studio?
Have you delcared the tag AjaxControlToolkit at the top of the page?
We are not a Code Charity
|
|
|
|
|
ya i have added this in my master page...
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
its working fine on my local server..but on net its giving the exception...Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The system cannot find the file specified....please help me
|
|
|
|
|
Server has "AJAX extensions" installed ?
|
|
|
|
|
You need to make sure ajax is installed on your server as well as your localmachine
We are not a Code Charity
|
|
|
|
|
No ajax is not installed on server....is der any other way to run the site without installing the ajax on server.....cann't it run only by copying the dll on bin folder....please tell if der is any other way....
|
|
|
|
|
Nope I'm pretty sure you have to have ajax installed on the server because that is where the code is going to be running and it needs to know what the control is.
Its not hard to install on the server, is there any reason why your hesitant?
We are not a Code Charity
|
|
|
|
|
what i have to download the ASP.NET AJAX Extensions 1.0 or ASP.NET AJAX Control Toolkit...i m working on ASP.NET 2.0...
|
|
|
|
|
I would down load 1.1 as the new one is designed for 3.5 framework.
Then just install on the server as you have done for the other toolkit
We are not a Code Charity
|
|
|
|
|
Hi,
Here is another way of doing it.
Create a AjaxDlls folder in your project and copy all 4 dlls to it, and reference the ajax dlls by adding them to your project from AjaxDlls folder. When you install ajax some dlls get registered in your machine’s GAC and when you add AJAX controls, it may get referenced from GAC.
I feel you may, already have those references, if you right click project and go to properties page you will see all the references and from where they are added to your project. So remove those references and add the references again from the AjaxDlls folder you created earlier and build it. This does not require you to install AJAX in your production server.
Thx,
Gayani
|
|
|
|
|
How can he add them from his local machine where they were installed and reference them from his production server? surely that wont work
We are not a Code Charity
|
|
|
|
|
Hi all,
Assume there are 2 projects in same server.
Eg: "Project1" , "Project2" and "Web Service".
Project1 is having some cache. Eg: cache1, cache2;
Project2 is having some cache. Eg: cache3, cache4;
I need to get the values of cache from Project1 using Web Service.
is it possible? Please tell me if anybody knows.
Thanks & Regards
Kumaran
|
|
|
|