|
The big issue with dynamic controls is that if you don't create them before page load, they have no viewstate.
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.
|
|
|
|
|
Ok Sir,
but I just want to track which txt box has been focused , or hovering or clicking it a msg to show or will go to the redirected page. It will also work.
Your excellency.
![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Hai
i want to send sms from website any one explaine about that , ya i download some model projects but all the project send sms by using web services , i am working with asp.net C#, so help me out friend's ![Sniff | :^)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_sniff.gif)
|
|
|
|
|
fak.kumar wrote: but all the project send sms by using web services ,
Well, of course they would. How else would a web page send an SMS ?
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.
|
|
|
|
|
fak.kumar wrote: i download some model projects but all the project send sms by using web services , i am working with asp.net C#, so help me out friend's
So what is your problem?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Of course, there should be some web interface which sends sms for you. If you are looking for a free service, you might go for way2sms. but I dont think it is a good idea as it works only for India.
There are lots of other sites which offer sms services with minimum cost. You might opt for them.
|
|
|
|
|
fak.kumar wrote: ya i download some model projects but all the project
If you Dont Want to use webservice build your own server..!
Otherwise there is no other option Maximum third party guys provides Webservices to send sms
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
hii m getting error:Object cannot be cast from DBNull to other types
when m trying to update the productqty.the code is:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = (DataTable)Session["cart"];
DataList1.DataSource = dt;
DataList1.DataBind();
}
}
protected void Datalist1_Update(object source, DataListCommandEventArgs e)
{
int ProductID = Convert.ToInt32(DataList1.DataKeys[e.Item.ItemIndex]);
TextBox txtProductQty;
txtProductQty = (TextBox)e.Item.FindControl("txtProductQty");
string connectionstring = ConfigurationManager.ConnectionStrings["SilverOnline"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionstring);
string str="Update Home Set ProductQty=@ProductQty Where(ProductID=@Productid)";
SqlCommand cmd = new SqlCommand(str,conn);
cmd.Parameters.Add("@ProductQty", SqlDbType.VarChar).Value = txtProductQty.Text; ;
cmd.Parameters.Add("@Productid", SqlDbType.Int).Value = ProductID;
if (conn.State == ConnectionState.Closed)
conn.Open();
cmd.ExecuteNonQuery();
if (conn.State == ConnectionState.Open)
conn.Close();
DataList1.EditItemIndex = -1;
DataTable dt = (DataTable)Session["cart"];
DataList1.DataSource = dt;
DataList1.DataBind();
}
plz guide....
|
|
|
|
|
"m workin as a web developer in a software company.
i work on asp.net using csharp....."
And you've been a member here for some time, but you still think that your use of horrible and worthless variable names is a good subject line and can't read an error message ?
mylogics wrote: if (!IsPostBack) { DataTable dt = (DataTable)Session["cart"]; DataList1.DataSource = dt; DataList1.DataBind(); }
Things that suck about this code
1 - you have a datatable in the session
2 - your page will blow up if no table is found
3 - the prerender event is when you should bind to data sources. For example, you're rebinding PRIOR to the update event, which is probably going to screw you up.
You're REALLY paid to write web code ?
mylogics wrote: string str="Update Home Set ProductQty=@ProductQty Where(ProductID=@Productid)"; SqlCommand cmd = new SqlCommand(str,conn); cmd.Parameters.Add("@ProductQty", SqlDbType.VarChar).Value = txtProductQty.Text; ; cmd.Parameters.Add("@Productid", SqlDbType.Int).Value = ProductID;
This is so, so hideous. I can only assume your clients are never people who have any idea about application development ?
mylogics wrote: DataTable dt = (DataTable)Session["cart"]; DataList1.DataSource = dt; DataList1.DataBind();
Where in this mess, do you expect the value in your sesson to be updated by the SQL you ran ?
This is an utter disaster. I don't see much worth salvaging, you work in a company ? Are there more experienced developers who could help you start this task again, or are you the zenith of the skillset 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.
|
|
|
|
|
A couple of things to add
1 - if you want help, respond when we try to answer you
2 - try reading the posting guidelines, you obviously never have
3 - if you can't tell us what line is causing the error, or detailing what debugging you've done, when you admit that you're being paid for this utter disaster, then don't expect too much help. We couldn't recreate your situation if we wanted to, so we can't run your code, you need to tell us what line blows up, at least.
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.
|
|
|
|
|
protected void Update(object source, DataListCommandEventArgs e)
{
int ProductID = Convert.ToInt32(DataList1.DataKeys[e.Item.ItemIndex]);
TextBox txtqty;
txtqty = ((TextBox)e.Item.FindControl("txtqty"));
string connectionstring = ConfigurationManager.ConnectionStrings["SilverOnline"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionstring);
SqlCommand cmd = new SqlCommand("Update Home Set ProductQty=@productqty Where ProductID=@productid", conn);
cmd.Parameters.Add("@productqty", SqlDbType.VarChar).Value = txtqty.Text;
cmd.Parameters.Add("@productid", SqlDbType.Int).Value = ProductID;
if (conn.State == ConnectionState.Closed)
conn.Open();
cmd.ExecuteNonQuery();
if (conn.State == ConnectionState.Open)
conn.Close();
DataList1.EditItemIndex = -1;
// Bindlist();
Session["cart"] = dt;
DataList1.DataSource = dt;
DataList1.DataBind();
lbltotal.Text = "Rs." + gettotal();
}
You posted this a week ago. All the changes I Can see in your code from then, represent places where it might have worked before, and it won't now. It looks to me like you've wandered aimless for an entire week before asking again.
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.
|
|
|
|
|
mylogics wrote: plz guide....
Stop writing software. It's plain you have a job you don't deserve, you have no clue what you're doing, you ask the same questions over and over and when people try to answer, you don't respond.
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 everybody,
My request out here is Urgent, though i have passed through what I could access in this forum and others also, but cannot finding a working solution.
I have designed an ASP.NET application, at our organizational intranet, I have used Windows Authentication and it worked very efficiently. My problem is, I want my application to ask for re-entering of employee's credential when he clicked on a log out control ( it could be anything - i didn't decided what will trigger log out yet ). I want it to be like Sharepoint page where you can log as another user in the same machine.
I m using following code but not working properly.
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
if (!this.IsPostBack)<br />
{<br />
_User = User.Identity.Name.Replace("Domain\\", "");<br />
Label1.Text = _User;<br />
}<br />
}<br />
protected void LinkButton1_Click(object sender, EventArgs e)<br />
{<br />
<br />
Response.StatusCode = 401;<br />
Response.StatusDescription = "Unauthorized";<br />
Response.End();<br />
Response.Redirect("Default.aspx"); <br />
}<br />
<br />
and HTML is
<br />
<head runat="server"><br />
<title>Untitled Page</title><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<p>Hello <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></p><br />
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">Sign in as Different user</asp:LinkButton><br />
</div><br />
</form><br />
</body><br />
</html><br />
I am waiting ...
Thanks.
|
|
|
|
|
I Have also tried
document.execCommand("ClearAuthenticationCache")
but it only works on IE and on the server machine only , on clients machine it won't work
|
|
|
|
|
somewhere i found this modified code
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.hiddenCurrentUser.Value = Request.LogonUserIdentity.Name;
_User = User.Identity.Name.Replace("Domain\\", "");
Label1.Text = _User;
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
if (this.hiddenCurrentUser.Value != Request.LogonUserIdentity.Name)
{
Response.Redirect("Default.aspx");
}
else
{
Response.StatusCode = 401;
Response.StatusDescription = "Unauthorized";
Response.End();
}
}
and HTML is
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>Hello <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></p>
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">Sign in as Different user</asp:LinkButton>
</div>
<input type="hidden" id="hiddenCurrentUser" name="hiddenCurrentUser" runat="server" value="0" visible="false" />
</form>
</body>
</html>
now the problem is
what happen if i enter the same credential again?
i am using the above given code and when i am entering different credentials then its working fine.
but when i am using same credentials then it again ask for credentials for 2 more times.
and after clicking 3 times the page get washout.
and when i click on back button and again refresh the page then it accepts the credentials...
plz suggest me some way to overcome this problem..
modified 4-May-22 6:24am.
|
|
|
|
|
Why dont you show a popup just when user clicks for logout and ask for password there.
You might use popupextender to do this.
|
|
|
|
|
Dear Abhishek I am Using Integrated Windows Authentication.
so no need to use popup.
Ok.
Please provide such a solution which will be better for the application.
Do not use 'JUGAD' for the solution.
Thanks for your reply.
|
|
|
|
|
dharam_hbtik wrote: Do not use 'JUGAD' for the solution.
Sorry.. I forgot what JUGAD means... Well you noida people use this term often, I heard.
Regarding your issue,
You might use any location redirection to have your logout procedure. Dont place the actual logout link to your browser in Logout link. Rather place the link to the page that needs credentials.
I hope this would be good for you.
modified on Monday, November 16, 2009 4:46 AM
|
|
|
|
|
Actually I have a master page and my link is on Master page.
so when ever i Click on the login as different user the IIS authentication window appears for the authentication.
Now the code i am using is fine up to some extent.
When I enter credentials then it ask 3 times for the same and then it authenticate.
when i modified the code which is given in the post then when i click on the logout link first time then IIS doesn't ask for the credentials but when i click second time then only it ask and it also accpts the credentials in one time.
so i need to know how can i made IIS to ask for credentials for the first Click only.
|
|
|
|
|
I think if you want to give these sort of orders, you should go to the job section and pay someone to do your work for you.
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.
|
|
|
|
|
thanks for your suggestion.
but here forum is for answer not like ur suggestion.
|
|
|
|
|
Actually, this forum is for helping people who are trying and need some help. It's not for making demands, or being rude, or taking on a job you have no idea how to do, then asking people here to do it for you.
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.
|
|
|
|
|
thanks for your suggestion dear.
I am not rude.
if you dont know the answer then please dont reply.
Thanks for your valuable suggestions.
|
|
|
|
|
It's possible that the language barrier is part of the problem, but certainly when you post what looks like a demand, it comes across as rude. If you don't mean it that way, perhaps pay attention to what the few English speakers who ask questions say, and consider how their manner is different from yours.
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.
|
|
|
|
|
dharam_hbtik wrote: but here forum is for answer
Only when you ask politely, otherwise ...
|
|
|
|