|
foreach(control c in yourpanel)
{
if(c is DropDowmList)
{
(c as DropDowmList).Item...........>do some thing you want
}
}
|
|
|
|
|
Use javascript validation.Add onchange attribute for dropdownlist and write your own javascript method.
|
|
|
|
|
Hi,
Like everybody else on this planet, I am currently working on a blogging engine using ASP.NET MVC .
I am planning to make this open source under GPL, with a requirement that people already have ASP.NET 3.5 already installed on their machines. Let us say that they do not already have ASP.NET MVC installed (on a shared host)
But, since the application uses MVC, I would want to include the following references in the bin directory,
* System.Web.Mvc
* System.Web.Routing
* System.Web.Abstractions
(Source: http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx[^])
My question is, Is it perfectly legal for me to include these DLLs in the bin directory when sharing the application?
Thanks,
Chandra
modified on Wednesday, August 26, 2009 10:50 PM
|
|
|
|
|
These will be available with everyone when they install ASP.NET MVC extensions. You don't have to supply those again. In fact, you don't have to supply any DLL you use. Just provide the source and build instructions. So people can build it and create the assemblies.
|
|
|
|
|
Thanks Navaneeth,
I guess I can then add this to the requirement list. That people have ASP.NET MVC extensions installed and ready. That seems to be the best way.
Have a good day
|
|
|
|
|
Yes. That'd be the obvious way.
Good day to you too.
|
|
|
|
|
|
First you should read the "How to get an answer to your question" post. I'll give you a hint, simple application isn't a very good subject line.
Next you should probably read this[^] article.
only two letters away from being an asset
|
|
|
|
|
|
In addition to the other suggestions, buy a basic book and work through it before you start trying to write any code that you expect to work properly. It's clear you have no grasp of the basics. We can't really help you there.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi thanks for your mail.
Iam reading basics in dot net now.
Thanks 4 u suggestion.
Regards,
Jags.
|
|
|
|
|
no application is simple but the criteria of developer makes its simple,
you can see this article
|
|
|
|
|
I want to put one button just near the right side of the screen, how to do?
thanks.
|
|
|
|
|
Use absolute positioning and place it where you'd like. Otherwise, determine the screen size with JavaScript and position it appropriately. Don't forget to handle the resize event.
only two letters away from being an asset
|
|
|
|
|
You can use div and in the style attribute use absolute positioning with y axis and x axis.
|
|
|
|
|
Hi,
1)I am having one dropdownlist,one textbox and one submit button shown below
<asp:dropdownlist autopostback="true" cssclass="textboxGQ_New" width="200px" id="drp_Category" runat="server" onselectedindexchanged="drp_Category_SelectedIndexChanged">
<asp:listitem value="">Select Category
<asp:listitem value="Samp1">Sample1
<asp:listitem value="Samp2">Sample2
<asp:listitem value="Samp3">Sample3
<asp:listitem value="Samp4">Sample3
2)My isssue is If i select Sample1 or Sample3 from the dropdownlist the text box should fire requiredfield validation i.e it has to show an alert as plz enter text in the textbox.
3)If i select Sample2 or Sample3 from the dropdownlist the text box should not fire requiredfield validation i.e it should not fire any validation and should accept null value while submit button is clicked
4)plz provide the sample code for the above issue..i want server-side code..i don't want Using JavaScript funtions....
|
|
|
|
|
shaik_mr wrote: plz provide the sample code for the above issue..i want server-side code..i don't want Using JavaScript funtions
Where shall I sent the invoice for writing this for you?
only two letters away from being an asset
|
|
|
|
|
shaik_mr wrote: ..i want server-side code..i don't want Using JavaScript funtions....
Well, if you want server side code, you don't even need a 'validator', unless you're using that overall framework. And the code is so trivial, that I don't see why you'd have trouble at least trying to write it, and posting a more specific question if you get stuck.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hello,
I want submit button to fetch different query results from the database. So I have implemented which query to execute inside the SubmitButton_Click function/method. But it's not working as I have desired....it's fetching one query every time.
To give you a brief idea, in my .aspx I have 2 dropdown lists (1 to select which query to run and another one to select which patient number should I pull from the DB), 1 text box which contains date field. I have kinda found what's causing the problem....but don't know how to solve it. Somehow from the drop down list "ANY" is selected all the times.....no matter what I select from the second dropdown list. Any suggestion would be really helpful.
The code is as follows:
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml;
namespace HIV
{
public class run_specific_query : System.Web.UI.Page
{
protected HIV.Controls.NavMenu navMenu;
protected HIV.Controls.NavSubMenu navSubMenu;
protected System.Web.UI.HtmlControls.HtmlGenericControl message;
protected System.Web.UI.WebControls.Label resultsLabel;
protected System.Web.UI.WebControls.DropDownList Specific_Query_DDL;
protected System.Web.UI.WebControls.DropDownList mlno_DDL;
protected System.Web.UI.WebControls.TextBox date_TB;
protected System.Web.UI.WebControls.CompareValidator dateValidator;
protected System.Web.UI.WebControls.DataGrid resultsDatagrid;
protected System.Web.UI.WebControls.Button submitButton;
protected System.Web.UI.WebControls.Label data_src;
protected System.Web.UI.WebControls.LinkButton exportLinkbutton;
private void Page_Load(object sender, System.EventArgs e)
{
navMenu.SelectedMainItem = HIV.Controls.NavMenu.MainItems.QUERY;
navSubMenu.SelectedMainItem = HIV.Controls.NavMenu.MainItems.QUERY;
navSubMenu.SelectedSubItem = HIV.Controls.NavSubMenu.SubItems.RUN_SPECIFIC_QUER Y;
getMLNO();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
BuildQueryForm(); [This function/method is calling the submit button function]
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.exportLinkbutton.Click += new System.EventHandler(this.exportLinkbutton_Click);
this.Load += new System.EventHandler(this.Page_Load); [after the data is pulled from the DB the export to excel button should show up, so I have implemented this here]
}
#endregion
protected void BuildQueryForm()
{
try
{
this.submitButton.Click += new System.EventHandler(this.submitButton_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
catch(Exception e)
{
message.InnerHtml = "Exception: " + e.ToString();
}
}
private void getMLNO()
{
OleDbConnection connection = new OleDbConnection(HIV.Database.DataConstants.CONNECT ION_STRING);
OleDbDataAdapter adapter = new OleDbDataAdapter();
OleDbCommand command = new OleDbCommand("SELECT DISTINCT re_MLNO FROM ml_hiv_status", connection);
DataSet ds = new DataSet();
adapter.SelectCommand = command;
if (adapter.Fill(ds) > 0)
{
int adp= adapter.Fill(ds);
DataView view = ds.Tables[0].DefaultView;
mlno_DDL.DataSource = view;
mlno_DDL.DataValueField="re_MLNO";
mlno_DDL.DataBind();
resultsLabel.Visible= true;
mlno_DDL.Items.Insert(0, "ANY");
}
connection.Close();
}
private void submitButton_Click(object sender, System.EventArgs e)
{
if(Specific_Query_DDL.SelectedItem.Value=="default ")
{
resultsLabel.Visible= true;
resultsLabel.Text ="Please select a specific query from the dropdown list";
exportLinkbutton.Visible = false;
}
if(Specific_Query_DDL.SelectedItem.Value=="Resista ntL")
{
resultsLabel.Visible= true;
resultsLabel.Text ="You Have selected"+ Specific_Query_DDL.SelectedItem.Value;
}
if(Specific_Query_DDL.SelectedItem.Value=="Negativ eL")
{
resultsLabel.Visible= true;
resultsLabel.Text ="You Have selected"+ Specific_Query_DDL.SelectedItem.Value;
}
if(Specific_Query_DDL.SelectedItem.Value=="Positiv eL") [The problem is here in this if else block]
{
if(mlno_DDL.SelectedItem.Value=="ANY")
{
executePositiveListQuery_ANY(); [All the time this one is called but...]
}
else
{
executePositiveListQuery_MLNO(mlno_DDL.SelectedIte m.Value); [...I want this method to be called as well when I am selecting a specific patient number]
}
}
if(Specific_Query_DDL.SelectedItem.Value=="DeadL")
{
resultsLabel.Visible= true;
resultsLabel.Text ="You Have selected"+ Specific_Query_DDL.SelectedItem.Value;
}
}
public void executePositiveListQuery_ANY()
{
string sql= "SELECT DISTINCT re_MLNO FROM ml_hiv_status WHERE (re_HIV1_Status=1 AND re_HIV2_Status=1)";
try
{
OleDbConnection connection = new OleDbConnection(HIV.Database.DataConstants.CONNECT ION_STRING);
OleDbDataAdapter adapter = new OleDbDataAdapter();
OleDbCommand command = new OleDbCommand(sql, connection);
DataSet ds = new DataSet();
adapter.SelectCommand = command;
int count = adapter.Fill(ds);
if (count > 0 && count <= 200)
{
DataView view = ds.Tables[0].DefaultView;
resultsDatagrid.DataSource = view;
resultsDatagrid.DataBind();
resultsDatagrid.Visible = true;
resultsLabel.Text = count.ToString() + " results found.";
resultsLabel.Visible = true;
exportLinkbutton.Visible = true;
}
else if (count> 200)
{
DataView view = ds.Tables[0].DefaultView;
resultsDatagrid.DataSource = view;
resultsDatagrid.DataBind();
resultsDatagrid.Visible = false;
resultsLabel.Text = "More than 200 results found. Please Click the Export to Excel Link to Download the Results.";
resultsLabel.Visible = true;
exportLinkbutton.Visible = true;
}
else
{
resultsLabel.Text = "No results found.";
resultsLabel.Visible = true;
exportLinkbutton.Visible = false;
resultsDatagrid.Visible = false;
}
connection.Close();
}
catch(Exception ex)
{
message.InnerHtml = "SQL: " + sql + "<p></p>" + ex.ToString();
}
}
public void executePositiveListQuery_MLNO(string selected_MLNO)
{
resultsLabel.Text ="You Have selected"+ selected_MLNO;
}
private void exportLinkbutton_Click(object sender, System.EventArgs e)
{
resultsDatagrid.Visible = true;
DataGridItem tblGrid=resultsDatagrid.Items[0];
ArrayList alLinks= new ArrayList();
TableCell TC;
LinkButton LB;
for(int i=0; i<tblGrid.Cells.Count - 1; i++)
{
TC=tblGrid.Cells[i];
if(TC.Controls.Count> 0)
{
LB=(LinkButton)TC.Controls[0];
resultsDatagrid.Items[0].Cells[i].Controls.Clear();
resultsDatagrid.Items[0].Cells[i].Text=LB.Text;
}
else
LB=new LinkButton();
alLinks.Add(LB);
}
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
resultsDatagrid.EnableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
resultsDatagrid.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
for(int i=0; i<tblGrid.Cells.Count - 1; i++)
{
LB = (LinkButton)alLinks[i];
resultsDatagrid.Items[0].Cells[i].Controls.Add(LB);
}
}
}
}
Please help! Thanks to everyone who give their time and energy to solve this.
|
|
|
|
|
I'm not a C# guy, but it sure seems like you call getMLNO on every page_load which then adds in the "Any" item into the dropdownlist which overrides what the user selected. Put that in a If Not Ispostback then (C# equivalent for you) you should be all set.
|
|
|
|
|
I don't know how to thank you enough! all these times I am wondering why this is happening!! But I understood that something is wrong with the post back condition and the way I am calling getMLNO() cause every time I refresh the page or hit submit the MLNO dropdown list was getting refreshed as well and thus selecting ANY every time....
|
|
|
|
|
My pages worked fine, when they were located on the root of my project. When I moved them to folders, in preparation of doing roles/permissions, I had some issues that I worked through.
Dropdownlists with AutoPostBack = "False" on the page work fine. But, I cannot seem to get past an issue with a dropdownlist that does a postback. I am getting an error: Sys.Webforms.PageRequestManagerServerErrorException. The status code returned from the server was: 404.
I think the problem is related to AutoPostBack and UpdatePanel, but I don't know how to fix it. If someone could point me in the right direction, I would appreciate the assistance.
|
|
|
|
|
Going to need a little bit more then this to go off of, like some code.
|
|
|
|
|
dear friends...
i am designing a new portal there i need to generate a personal url to every people when joined. then he will use that url to make others will join under him. so plz kindly give me suggestions.
thank you to all in advance.
|
|
|
|
|
Read about URL rewriting.
|
|
|
|