|
Can you please provide me with the code
|
|
|
|
|
Hi,
I have defined a combo box in an aspx page in which values are dynamically filled from database. I wrote an event on this combo box to update a label control on the same page.
Whenever the user choose an item in the combo box, the event written for updating another label control is working properly, but after that the first item in the combo box is selected. I guess that it is due to re-binding of combo box after this event. Is there a way to avoid this? Pls help.
Combo Event and its related code:
protected void Page_Load(object sender, EventArgs e)
{
BindControls();
}
#region Data Binding Procedures
private void BindControls()
{
this.BindDistributor();
this.BindModuleName();
this.DataBind();
}
private void BindDistributor()
{
this.BindDistributorID();
this.BindDistributorName();
}
private void BindDistributorID()
{
SqlConnection SqlConn = DataAccess.OpenConnection();
DataSet dsDistributor;
if (chkShowAllDistributors.Checked)
{
SqlParameter SqlParam = new SqlParameter("ShowAll", 'Y');
dsDistributor = DataAccess.GetDataSet(SqlConn, CommandType.StoredProcedure,
SPs.GetDistributorName, new SqlParameter[] { SqlParam });
}
else
{
dsDistributor = DataAccess.GetDataSet(SqlConn, CommandType.StoredProcedure, "GetDistributorName");
}
if (dsDistributor.Tables.Count > 0)
{
this.ddlDistributor.DataSource = dsDistributor.Tables[0];
this.ddlDistributor.DataValueField = Colums.DistributorID;
this.ddlDistributor.DataTextField = Colums.DistributorShortName;
}
}
private void BindDistributorName()
{
DataView dvDistributor = ((DataTable)ddlDistributor.DataSource).Copy().DefaultView;
if (this.ddlDistributor.SelectedIndex != -1)
{
dvDistributor.RowFilter = Colums.DistributorID + "='" + ddlDistributor.SelectedValue.ToString() + "'";
if (dvDistributor.Count > 0)
{
this.lblDistributorName.Text = dvDistributor[0][Colums.DistributorID]
+ " - " + dvDistributor[0][Colums.DistributorName];
}
}
}
#endregion
protected void chkShowAllDistributors_CheckedChanged(object sender, EventArgs e)
{
this.BindDistributor();
}
|
|
|
|
|
Can you check with isPostback property in page load event like:
protected void Page_Load(object sender, EventArgs e)
{
If( ! IsPostBack)
BindControls();
}
|
|
|
|
|
Thanks Parwej. It worked.
|
|
|
|
|
|
Hi,
Instead of loading the frame from the Server, you should do this via the client.
This will not submit your treeview frame and your sideframe will get loaded.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hello,
I followed step by step the article "Role-based Security with Forms Authentication" written By Heath Stewart, posted on 17 Sep 2002 (http://www.codeproject.com/KB/web-security/formsroleauth.aspx) but I encounted a pb (cf. comment in code):
protected void LoginButton_Click(object sender, EventArgs e)
{
FormsAuthentication.Initialize();
string adPath = "LDAP://Media.local/DC=Media,DC=local";
Identification adAuth = new Identification(adPath);
try
{
if (true ==adAuth.IsAuthenticated("Media\\",Login1.UserName.ToString(),Login1.Password.ToString()))
{
string groups = adAuth.GetGroups();
//I typed in login field AdminAchat (without domain\\)
//The break point shows that adAuth._path = "LDAP://Media.local/CN=AdminAchat,OU=autres
//comptes,OU=Utilisateurs,OU=Paris,OU=Media,DC=Media,DC=local"
//-->Go Directly to Catch, see break point in GetGroup method below
//...
//...
}
}
catch(Exception ex)
{
lErreur.Text = "Error authenticating. " + ex.Message;
}
}
public string GetGroups()
{
DirectorySearcher search = new DirectorySearcher(_path);
search.Filter = "(cn=" + _filterAttribute + ")";
search.PropertiesToLoad.Add("memberOf");
StringBuilder groupNames = new StringBuilder();
try
{
SearchResult result = search.FindOne();
//-->Go directly to catch. WHY???
//...
}
catch(Exception ex)
{
throw new Exception("Error obtaining group names. " + ex.Message);
}
return groupNames.ToString();
}
here's my web.config:
<xml version="1.0" ?="">
<configuration>
<connectionstrings>
<add name="ADMedia" connectionstring="LDAP://Media">
<system.web>
<authentication mode="Forms">
<forms loginurl="login.aspx" path="/" requiressl="false"
="" cookieless="UseDeviceProfile" enablecrossappredirects="false" protection="All" domain="http://Media" name=".ASPXFORMSAUTH">
<membership defaultprovider="AspNetActiveDirectoryMembershipProvider">
<providers>
<remove name="AspNetActiveDirectoryMembershipProvider">
<add connectionstringname="ADMedia" connectionusername="media\AdminAchat" connectionpassword="****" name="AspNetActiveDirectoryMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider,System.Web,version=2.0.0.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<rolemanager enabled="true">
<anonymousidentification enabled="true">
N.B. the Active Directory is a Outlook base found in a server that i'm not admin (i have no right to add, modify, delete) & linked to my pc via intranet.
Can you tell me why I get this error please? Thanks
|
|
|
|
|
Hi,
Given below is the main aspx file in which the HTML Framework related code snippets are there:
<frameset cols="25%,*">
<frame name="TreeView" src="TreeViewMenu.aspx" />
<frameset rows="40%,*">
<frame name="Parameters" src="UploadPage.aspx" />
<frame name="DataDisplay" src="DataDisplay.aspx" />
</frameset>
</frameset>
I am facing a very simple issue for which I am not able to find an answer yet! I just wanna load a aspx page inside one of the frames during run time. i.e.
On the left side frame [name=”TreeView”], the Webpage contains a TreeView, which is filled hierarchically from a database table. Now when the user clicks on the leaf nodes, it should open a .aspx page on the right side frame [name=”Parameters”].
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
string strSelected = ((TreeView)sender).SelectedNode.Value.ToString();
switch (strSelected)
{
case "Node1":
break;
}
}
Can anybody please help me on this!
|
|
|
|
|
kmsangeeth wrote: What code should I put here...
Response.Write("<script>window.open("PageName.aspx","FrameName");</script>")
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
It Worked. Thanks a lot Manas, for your immediate correct response.
Also Special thanks to Code Project.
|
|
|
|
|
In development of my website i hav to store physical file in website folder and location path in the database..............Physically file is transfering but when i m going to save the path.......its taking full path.....instead of this it shud take only folder name and file name. My code is:
fuCategory.SaveAs((Server.MapPath(Request.ApplicationPath) & "\Images\") + fuCategory.FileName)
Dim destipic As String
destipic = Server.MapPath(Request.ApplicationPath) & "\Images\" & fuCategory.FileName
Dim cmd As String = "Insert into Categories(CategoryName,CategoryPic)Values('" + txtCategoryName.Text + "','" + destipic + "')"
Dim dbcmd As DbCommand = db.GetSqlStringCommand(cmd)db.ExecuteNonQuery(dbcmd)
GridView1.DataBind()
|
|
|
|
|
KhandelwalA wrote: destipic = Server.MapPath(Request.ApplicationPath) & "\Images\" & fuCategory.FileName
destipic = Request.ApplicationPath & "\Images\" & fuCategory.FileName
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I have written two events - on a checkbox (CheckedChanged) and on a combo box (SelectedIndexChanged) both are not working! Can anybody help me on this regards. Related code snippets are pasted below:
Abcd.aspx contents:
<asp:CheckBox ID="chkShowAllDistributors" runat="server" checked="false" Text="Show All Distributors" OnCheckedChanged="chkShowAllDistributors_CheckedChanged"/><br /><br />
<asp:DropDownList ID="ddlDistributor" runat="server" OnSelectedIndexChanged="ddlDistributor_SelectedIndexChanged"></asp:DropDownList>
Abcd.aspx.cs contents:
protected void chkShowAllDistributors_CheckedChanged(object sender, EventArgs e)
{
this.BindDistributor();
}
protected void ddlDistributor_SelectedIndexChanged(object sender, EventArgs e)
{
this.BindDistributor();
}
|
|
|
|
|
Member 2230125 wrote: <asp:checkbox id="chkShowAllDistributors" runat="server" checked="false" text="Show All Distributors" oncheckedchanged="chkShowAllDistributors_CheckedChanged">
<asp:dropdownlist id="ddlDistributor" runat="server" onselectedindexchanged="ddlDistributor_SelectedIndexChanged">
//include
AutoPostBack="True"
|
|
|
|
|
Hi buddies,
Im using a line chart. I have a dataview having 4 columns.I have used points.databind() method where im able to bind x and y as well as in the fourth parameter im able to give tooltip=only 1 column name
How to give more than 1 column as a tooltip for a series?
for e.g I have empname.empsal,comm,bonus columns
ive given like chart1.series["s1"].points.databind(dv,"empname","empsal","tooltip=bonus");
I wish to 2 set bonus,empsal and comm for the tooltip property
Can any1 help me with the solution ?Thanx in advance.You can mail the code to me @ balajii78@yahoo.com
T.Balaji
|
|
|
|
|
balaji.t wrote: You can mail the code to me @ balajii78@yahoo.com
Do you really think that anyone has so much of time to send you the code on your email?
The only thing which you will get by posting you email address in a public forum is nothing but SPAM.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
hi dude,
Thanx..ill avoid giving emailids..if u knw the solution for my question kindly help me
T.Balaji
|
|
|
|
|
balaji.t wrote: if u knw the solution for my question kindly help me
Already gave you here[^]
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
balaji.t wrote: I wish to 2 set bonus,empsal and comm for the tooltip property
Create an extra column in the table which would contain the tooltyip value(combination of all the columns you need)
use this column for the tooltip property.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
hi,
I want to create progress bar in web forms
Plaese help me...
|
|
|
|
|
insert your code in update panel
and add following code
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="upPnl"
DisplayAfter="50">
<ProgressTemplate>
<img id="Img1" src="~/images/ajax.progress1.gif" runat="server" alt=""/>
Please Wait...
</ProgressTemplate>
</asp:UpdateProgress>
|
|
|
|
|
thanka for ur reply....
but i want to show Percentage like 5o% completed
|
|
|
|
|
This article [^]might be interesting for you.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
can u post some other code.....
|
|
|
|
|
rjayaabharathi@gmail.com wrote: can u post some other code.....
What was the problem with that ?
|
|
|
|