|
Hi..
thanks for reply.., i got some temparory solution,
I may draw your attention to this later on.
Thanks,
By:
Hemant Thaker
|
|
|
|
|
I am using this: btnDelete.Attributes.Add("onclick", "if(confirm('Are you sure you want to delete?')) Test1();else return false;")
my requirement is to be excute the function test1() but nothing happend
and iam also trying in this manner could anyone help me
Page.RegisterStartupScript("Confirm", "<script language=JavaScript>Confirm();</script>");
and in the aspx file (desiner) you need to write the following code
<script language="javascript" type="text/javascript">
Function Confirm() //Sample Function
{
var blnConfirm = confirm("sample function to test confirm function");
if(blnConfirm == true)
{
alert("you have clicked yes"); return false;
}
else
{
alert("you have clicked No");
}
}
</script>
|
|
|
|
|
use this code
<html>
<head>
<title>Custom ConFirm, Alert and Prompt</title>
<script language="javascript" type="text/javascript">
function FnConfirm()
{
var ans=confirm("Choose a button")
if (ans==true)
{
alert("You pressed OK");
FngoOK();
}
else
{
alert("You pressed Cancel");
FngoCancel();
}
}
function FngoOK()
{
window.location = "OK.htm";
}
function FngoCancel()
{
window.location = "Cancel.htm";
}
</script>
</head>
<body>
<input name="btnCheck" OnClick="FnConfirm()" Type="Button" Value="Click" />
</body>
</html> i tried this & working.
For server side you can do like this
btnDelete.Attributes.Add("onclick", "FnConfirm()")
|
|
|
|
|
thatraja wrote: btnDelete.Attributes.Add("onclick", "FnConfirm()")
Won't work without runat=Server on the input element.
Where did the OP ask about redirecting pages? and you are using far too much code to accomplish the very simple task
thatraja wrote: var ans=confirm("Choose a button")
You are uselessly creating another variable when this is enough
if( confirm("Choose a button") )<br />
...<br />
else<br />
...
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|Mark Nischalke wrote
1.Won't work without runat=Server on the input element.
2.Where did the OP ask about redirecting pages? and you are using far too much code to accomplish the very simple task
3.You are uselessly creating another variable when this is enough
=>1. I gave him a full HTML code and I was mentioned server side code will be like
btnDelete.Attributes.Add("onclick", "FnConfirm()") instead of
btnDelete.Attributes.Add("onclick", "if(confirm('Are you sure you want to delete?')) Test1();else return false;") also it wasn't mentioned as a client control by neither me or him.
=>2.Actually he called a function Test1() in his code so that i was created a 2 dummy functions for redirects based on the response for easy understand to him.
=>3.Here i copied his code & made some changes & posted here so i didn't created any new variable.
Happy coding Thanks
Regards,
thatraja
|
|
|
|
|
From your profile we can see you are not very proficient in these technologies. Perhaps do more studying before responding and answering.
thatraja wrote: btnDelete.Attributes.Add("onclick", "FnConfirm()")
This server side code can not be be called unless the client side element has the runat=Server attribute.
thatraja wrote: =>2.Actually he called a function Test1() in his code so that i was created a 2 dummy functions for redirects based on the response for easy understand to him.
Again, where is it stated by the OP that a redirected was needed? By added unnecessary features you may have done more to confuse than to help.
thatraja wrote: =>3.Here i copied his code & made some changes & posted here so i didn't created any new variable.
From this we can tell you are probably very profeccient at copy and paste coding and don't fully understand what you are doing. If you knew what you where doing you should have corrected the OPs code and explained why.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You are right mate, still didn't completed my Master degree & i hope it will take a year to complete. And now i'm started to studying in latest things in those technologies so that i joined also Codeproject this month which is nice.
|Mark Nischalke wrote
This server side code can not be be called unless the client side element has the runat=Server attribute.
but here the btnDelete is a server side element so that i was added the attribute in runtime.
Again, where is it stated by the OP that a redirected was needed? By added unnecessary features you may have done more to confuse than to help.
I accept this one my mistake because i didn't thought about his confusion by the redirection code. It would be better if i put those alert messages instead of redirections inside those dummy functions.
From this we can tell you are probably very proficient at copy and paste coding and don't fully understand what you are doing. If you knew what you where doing you should have corrected the OPs code and explained why.Actually already he was posted some sample code which has some issue. But i thought it would be better to make some changes in that code instead of writing an new one because he may be confuse here too. Also i have waited for his response. That's all.
Thanks for your feedback
Mate can you help me for my study by preferring things in technologies. Also i have visited your profile page but your blog isn't write mode for me. how to contact you? Please help. Thanks. 
|
|
|
|
|
I cant get you what you have studied if you are going to assist me in
learning technology i would be greatful and my mail id is mca.nath@gmail.com you can contact me through this maild
Thanks & Regards,
K. Amarnath.
|
|
|
|
|
Thanks for your help and i was to new to work with javascript
and if user clicks on ok then i have to redirect to another page
that is happening if on cancel then i have to focus him on a text
control. I will try for that. once again very thanks for your help
|
|
|
|
|
use the following script
<script language="javascript" type="text/javascript">
function FnConfirm()
{
if (confirm("Choose a button"))
{
window.location = "anotherpage.htm";
}
else
{
document.getElementById('anothertextbox').focus();
}
}
</script> Here 'anothertextbox' is the name of your another textbox.
|
|
|
|
|
Nath wrote: Page.RegisterStartupScript("Confirm", "Confirm();");
It is unnecessary to register the confirm script since you have already included it in the page.
<input type="button" value="Click Me" onClick="Confirm()"></input>
<script language="javascript" type="text/javascript">
function Confirm()
{
if (confirm("Are you sure you want to delete?"))
alert("Yes");
else
alert("No");
}
</script>
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hello .net professionals,
My questions are:
How do I go about my (asp.net) web application deployment?
Is it possible to package it as .exe file that will now be installed on any machine? If yes how.
How can I get Ms SQL client software so that the application can run on it.
How can I make sure that the first-time the (web) application is run, it runs my database script to create the application's database and other objects on the installation machine. Or to run the script while the application is installing.
Any other vital things for me to know about deployment. Please tell me.
I appreciate your assistance so far.
Thanks in anticipation.
Happy programming.
|
|
|
|
|
1)Yes it is Possible. go to your Solution Explorer and Right click on the Root of your Solution and select a New Project and in the Dialog box , select other Project and you will see websetup. Give it a name and when you create a setup meaning when you are happy with your web app , then you need to build your setup to release not debug and a file in the Release folder in your setup Project Directory will be created. that is what you should ship.
2)Do you mean SQLExpress? google it you will find a lot of hits on that.
look at this
Visual Studio Setups (Web Setup Part I)[^]
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Thanks a lot, I am grateful.
|
|
|
|
|
|
Infact, millions of thanks.
I appreciate your support. Thanks
|
|
|
|
|
|
It would be helpful to show the actual code you are using to assign the urls. What does the database results look like?
Assuming you are using HyperLink controls,
link.NavigationUrl = "Search/Cricket.aspx";
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
Useless crap!!! Learn how to format the code before posting again.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi
In my gridview, I want to count the number of times each value (based of course on a field in my gridview) occurs. For example, if I have a field called Dept, in my result there is the following:
Dept A
Dept A
Dept A
Dept B
Dept B
Dept C
What I am trying to do is to show that for each Dept A, the count is 3, and for Dept B, the count is 2 and for Dept C the count is 1. When I have my count, I want to save them into my hidden field, which I am going to use else where in my code.
I know I need to do this in my rowdatabound event, and I have had ago, but the results I am getting back are not correct.
How do I solve this problem?
|
|
|
|
|
Could you post the code which you are using, so some can have a look?
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.
|
|
|
|
|
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
Table tbl = e.Row.Parent as Table;
TableCell cell = new TableCell();
CheckBox chk = new CheckBox();
Label lbl2 = new Label();
HiddenField rowValue = new HiddenField();
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Visible = false;
}
else
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lbl = (Label)e.Row.FindControl("lblValue");
string str1 = ((Label)(lbl)).Text;
string prevStr= (string)Session["previousStr"];
if (prevStr== str1)
{
counter += 1;
}
else
{
prevStr= sr1 ;
Session["previousStr"] = prevStr;
counter = 1;
if (tbl != null)
{
GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
rowValue.ID = "hdnNumRows";
rowValue.Value = counter;
lbl2.Text = Convert.ToString(counter);
cell.ColumnSpan = this.GridView1.Columns.Count;
cell.Width = Unit.Percentage(100);
cell.BackColor = System.Drawing.Color.Aqua;
HtmlGenericControl span = new HtmlGenericControl("span");
span.InnerHtml = prevStr;
cell.Controls.Add(span);
cell.Controls.Add(chk);
cell.Controls.Add(lbl2);
cell.Controls.Add(rowValue);
row.Cells.Add(cell);
tbl.Rows.AddAt(tbl.Rows.Count - 1, row);
}
}
}
}
}
As you can see, I have a counter in both parts of my if statement. This is so that if the "if" part is true the counter goes up by one, else it is still one. When run this with JavaScript to show the results, it is fine, I am seeing 3, 2, 1, but when I try show this in a label, all I am seeing 1,1,1. Why?
|
|
|
|
|
Instead of doing this on webserver, why dont you do this in the SQL itself?
Add a new column, lets say DeptCount which would give you the count.
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.
|
|
|
|
|
The reason being is that I only want to show the count in my inserted row, the value of which I am going to use in my checkbox control to then hide or show the rows which the user checks the checkbox
|
|
|
|