|
Hi,
In my form I have 6 check boxes user selects those check boxes and clicks on button. On button click I have to insert those selected checkboxes into database table one row for each check box selection. Without business layer I am able to insert using StringBuilder appending each insert(checkbox selection) and exceuting all inserts with one database call. But I have business layer, I have to fill those business objects and insert values from business objects into database. How to do those multiple inserts with one database call when we are having business layer.
Thanks
|
|
|
|
|
Why do you have to have only one database call? Why can't you fill in and update several business objects from your button handler?
Are you using an ObjectDataSource? I don't recommend it for more complex table updates like this, but if so, you can handle the Inserting event, do whatever logic you need, and set e.Cancel = true so the ObjectDataSource won't actually do the insert (or update).
|
|
|
|
|
Hi, I need to send an email from my site and I'm using this code:
<br />
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)<br />
{<br />
CreateUserWizard wizard = (CreateUserWizard)sender;<br />
MembershipUser user = Membership.GetUser(wizard.UserName);<br />
<br />
if (user != null)<br />
{<br />
try<br />
{<br />
SmtpClient smtpClient = new SmtpClient("smtpServer");<br />
smtpClient.UseDefaultCredentials = true;<br />
smtpClient.Send("yourEmail", user.Email, "Account Conformation Email",<br />
"localhost/Confirm.aspx?id=" + user.ProviderUserKey.ToString());<br />
}<br />
catch (Exception ex)<br />
{<br />
Label1.Text = ex.Message;<br />
}<br />
}<br />
}
It gives me this kind of exception:
ex = {"The specified string is not in the form required for an e-mail address."}
Could somebody help me?
Thank you
|
|
|
|
|
"yourEmail" is not a valid email address. The first parameter should be the from address, not "yourEmail". I also wonder if your smtp server is really called "smtpServer".
|
|
|
|
|
Hi guys,
I need to build a Hierarchical Tree view structure (Manager > Employee relations)for my module which should be like
+ TopRootManager
- Manager 1
Employee1
Employee2
Employee3
- Manager 2
Employee1
Employee2
-Employee3
Employee1
Employee2
+ Manager 3
And Results should be from SQL database. Can any one help me plz !!!
From,
Menon
|
|
|
|
|
I have used the Telerik RAD Control TreeView to do this. Works very well.
http://telerik.com/products/aspnet/controls/treeview/overview.aspx
(I have no connection with Telerik other than as a happy customer)
|
|
|
|
|
Guys can any one help me out in Hierarchial Tree View for an organization.
from,
Menon
|
|
|
|
|
What else are you hoping for ? There's no tree control build into .NET, so a third party control is really your only option.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi
I have been trying for ages to fill a table with images which have been returned from a database
I removed my session that deals with log in status of the user, but when i removed it allowed all my images to be accessed and displayed in the table
When the user is logged in the session variable is set to yes and it will timeout within 30 mins of inactivity
can anyone tell me of a workaround so that i can still have this session and allow access to my images from this table?
my global.asax file has the following code
<%@ Application Language="VB" %><br />
<br />
<script runat="server"><br />
<br />
<br />
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)<br />
End Sub<br />
<br />
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)<br />
End Sub<br />
<br />
<br />
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)<br />
End Sub<br />
<br />
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)<br />
Session("Loggedin") = ""<br />
Session.Timeout = 30<br />
CheckLoggedIn()<br />
End Sub<br />
<br />
Sub Application_OnPostRequestHandlerExecute()<br />
CheckLoggedIn()<br />
End Sub<br />
<br />
Sub CheckLoggedIn()<br />
If Session("LoggedIn") = "" And InStr(Request.RawUrl, "userLogin.aspx") = 0 Then<br />
Server.Transfer("relogin.aspx?ReturnUrl=adminhome.aspx")<br />
End If<br />
End Sub<br />
<br />
<br />
<br />
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)<br />
<br />
End Sub<br />
<br />
</script>
|
|
|
|
|
Hi,
My project runs well on IE 6.0 but It doesnot appear correctly on other browsers including IE 7.0. What is the mistake?
with Regards
dev
-- modified at 12:09 Thursday 26th July, 2007
|
|
|
|
|
There could be any number of things wrong. Without seeing the actual generated html (and css) we're not going to be able to help you. Is your site publicly accessible anywhere?
One thing to check is to compare the source in different browsers. ASP.NET does some browser detection, and sends different html to different browsers. It's generally pretty good, and better in 2.0 than 1.1, but an example is panels. In 1.1, it will generate a single celled table to some browsers, and a div to others. You can override the behavior with a BrowserCaps setting in your web.config, but if you're using 2.0, you probably don't need to.
|
|
|
|
|
Hi
I have one problem Here
I have one site here and 2 users are there.
I want login 2 users of one site in server.
then we working with many different systems and access the data from the server with user ids.
if one user close the browser but session will not expire in server
every body access the data from 2 users with Queue System but once logining in server will not be expire.
How it is possible
if know any one plz give me a reply.
i have to implement this one.
thx Advance
ravi
|
|
|
|
|
I'm not exactly sure what you're asking, but there is no way the server will know a user has closed their browser, and hence know to expire the session.
|
|
|
|
|
Hi
Thx for ur reply
Is it possible to 2 users logged into server symaltaniously?
if it is possible , how to identify those user using our code.
thx
|
|
|
|
|
Session is unique for each browser/user.
Example:
Joe visits your website from his computer
Joe clicks on "Buy Coke"
Your website executes: Session("product") = "Coke"
Jane visits your website from her computer
Jane clicks on "Buy Pepsi"
Your website executes: Session("product") = "Pepsi"
There is no problem, Joe still has "Coke" in his Session, and Jane has "Pepsi" in hers.
If Joe closes his browser, and Jane immediately opens a browser on Joe's computer, then she might end up getting Coke.
Also, If Joe buys Coke using IE, and Pepsi using Firefox, there is no problem. There will be a separate session for each browser (IE or Firefox) coming from the same computer.
What is shared between all users is the Cache.
As for knowing who is executing your code, Page.User.Identity.Name will tell you the name used to log in.
|
|
|
|
|
Hi
Your Explanation is exactly right but our requirment is different.
actually my process is directly logging through the code only
in our office 40 member are there and site has 2 users accounts.
is it not possible to login 40 members into 2 user accounts.
that's why we are going to implement access the 40 members through 2 users
i want login users in server side, members pass the request and get the results but server side never logout if one memeber get the result over.
i think u can understand my process ,
then plz tell me how to handle 2 users acounts at server side.
thx
ravi
|
|
|
|
|
I'm still having trouble understanding you. I'm curious why you only have 2 user accounts. Is this your server, or are you trying to figure out how to let 40 users use 2 accounts on some other site? If that's the case, it really depends on how the other side is set up. It might have nothing to do with Session.
Perhaps if you clarify this sentence: "i want login users in server side, members pass the request and get the results but server side never logout if one memeber get the result over."
I'm not sure if you mean "the server side never logs out but I want it to" or "the server side logs out but I don't want it to".
|
|
|
|
|
Hi
thx for ur reply
exactly my meaning is " The server side never logs out."
i will give u another example
i have one web page which have 2 buttons.
when i click button open one user account and click second button open another user account.
how can i identify both users logged or not.
can u give me any idea about this
|
|
|
|
|
The cache is shared between all users...
Button 1: Cache("User1") = True
Button 2: Cache("User2") = True
on the server side you can determine if either or both have been clicked. However, you still have the problem that Cache times out, and how do you know if a browser is closed? You don't. The server has no way to know if a user has simply closed the browser.
I'm only tossing out suggestions. I'm sorry, but I still don't understand what you really want.
|
|
|
|
|
Hi
How to combine two Applications(solutions) into one application
"is there any possibility to work with two different kind of applications in a single application".
this is very urgent
if any one know plz reply me.
if know any examles forword to me
advance thanks
|
|
|
|
|
>How to combine two Applications(solutions) into one application
You can include the project(s) of one solution in another solution. Right click on the solution, Add Existing Project... and browse to a project from another solution (I have VS 2003 in front of me, can't remember if 2005 is slightly different)
>"is there any possibility to work with two different kind of applications in a single application".
You can have various project types in the same solution. I have one in front of me with a website, a windows form, and various business and data layer projects.
For a more complete answer, trying asking a more complete question.
It seems like most questions on here are 'very urgent'. Too urgent to even use complete sentences.
|
|
|
|
|
Hi,
I am trying to set the length of a field to a pre-defined certain value. For this reason I am padding right incase it is not the required lenght. for example
String1 = "Trailer1"
String2 = "Tra"
String1.ToString.PadRight(6) = "Traile" - should get me this value
String2.ToString.PadRight(6) = "Tra " - should get me this value.
Is it correct to use padright to limit the length of string?
Thanks so much for your time.
|
|
|
|
|
PadRight will not limit the length it will only pad it.
You example is not correct, but if you did:
String1.ToString.PadRight(6) = "Traile1" you would still get all seven characters. If you want to get only six characters you will need to substring after the padright
String1.ToString.PadRight(6).Substring(0,6)
Hope that helps.
Ben
|
|
|
|
|
Dear All,
I am mess with one situation let me explain the scenario.
I am making search form where I display 15 field in checkboxlist and user select one or two or three or any no to all field. Depending on his selection (he tick the field and click filter button ) Now in filter button click I create label and dropdownlist control(populated from database) and add it to placeholder control. Now I select value and click the search button. Now in search button I need to access those control and its selected value(ie label and droplistbox ).
I have made function to create label and dropdownlistbox which is
private void createcontrols()
{
foreach (ListItem li in CheckBoxListmst.Items)
{
if (li.Selected == true)
{
//code added to fetch dropdownlist
setting = ConfigurationManager.ConnectionStrings["StyleSearchConnectionString"];
if (setting != null)
{
Code to access data for populating dropdownlistbox
try
{
// added controls
Label label = new Label();
DropDownList dropdownlist = new DropDownList();
label.ID = "label" + i.ToString();
dropdownlist.ID = "dropdownlist" + .ToString();
i++;
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
Items for dropdownlist
}
PlaceHolder1.Controls.Add(label);
PlaceHolder1.Controls.Add(dropdownlist);
}
catch (SqlException ex)
{
}
Now this create function I call in one in filter button click event and second as
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
createcontrols();
}
Now in seach button click event when I am trying to access
Code is
Label objlbl;
DropDownList objdrop;
objlbl = this.Page.FindControl("label1") as Label;
objdrop = this.Page.FindControl("dropdownlist1") as DropDownList;if ((objlbl != null) && (objdrop != null))
{
cmd.Parameters.Add("@para1", SqlDbType.VarChar).Value = objlbl.Text; //Page.FindControl("label1").ToString() ;
cmd.Parameters.Add("@value1", SqlDbType.VarChar).Value = objdrop.SelectedValue;
}
I am getting objlbl and objdrop as null.
Please help
thanks
imaran khan
|
|
|
|
|
You will have to search the PlaceHolder control and not the page. You will have to do a PlaceHolder1.FindControl(controlid)
Label objLabel = PlaceHolder1.FindControl("Label1") as Label;
DropDownList objDropDown = PlaceHolder1.FindControl("dropdownlist1") as DropDownList;
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|