|
hi all...
plz help me i found error 500 on my web application.
plz somebody help me.
thanx in advance
maujiram
|
|
|
|
|
|
Hello All,
In my ASP.Net application, i am showing a confirmation box using javascript whenever user intends to delete something.
I have written this code in aspx file
function confirmation()
{
if(confirm("Are you sure?")==true)
return true;
else
return false;
}
Then on Page_Load of my codebehind, i am using this:
btnDelete.Attributes.Add("onclick", "return confirmation();")
It is working fine, if user click ok record is deleting and vice versa.
But when i am trying to write same thing for my GridView delete link its not working, i am writting this:
GridView1.Attributes.Add("OnRowDeleting", "return confirmation();");
Can anybody help me? why its not working for GridView_RowDeleting method?
Thanks,
Nagendra.
modified on Thursday, September 24, 2009 7:06 AM
|
|
|
|
|
nagendrathecoder wrote: function confirmation()
{
if(confirm("Are you sure?")==true)
return true;
else
return false;
}
This is messy as hell. Why not just return (confirm("Are you sure?")) ? Why not tell them what they are to be sure if, in case they don't realise what they pushed ?
nagendrathecoder wrote: GridView1.Attributes.Add("OnRowDeleting", "return confirmation();");
I'd guess that it's because you're trying to hook up to a code behind event, not an actual client side event. You could start by reading on the difference between the client and server.
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, i implemented what u mentioned(used just confirm & displaying proper msg).
I also understand that RowDeleting is server side event and onclick is client side.
But i want this functionality to work for GridView too, what can i do?
|
|
|
|
|
try to add itemtemplate in gridview and do it
<ItemTemplate>
<asp:LinkButton ID="Delete" CommandName="Delete"
OnClientClick="return confirm('Are you sure you wish to delete this item?')"
CausesValidation="false"
runat="server" Text="Delete" ></asp:LinkButton>
</ItemTemplate>
If It Helps Click It as Answer
|
|
|
|
|
i am using ItemTemplate rite now Let me try with that OnClientClick.
|
|
|
|
|
If It Helps Click It as Answer
|
|
|
|
|
hey thanks man, its working alright.
|
|
|
|
|
No Problem Any Time..!
If It Helps Click It as Answer
|
|
|
|
|
nagendrathecoder wrote: , its working alright.
Then you should vote / Rate his answer which helps you
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I did it.
|
|
|
|
|
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
The same thing will work here. actually you are not adding it at correct place. First of all, u are adding the attribute to Grid view. In fact when u wanna delete any item then i m sure u have placed some control in each row on clicking of that , that particular item will be deleted.
So if it is a LinkButton/Button in ItemTemplate then you can add the attribute to it onRowDataBound Event or RowCreated Event or OnClientClick Property itself.
<asp:TemplateField HeaderText="Delete" >
<ItemTemplate>
<asp:ImageButton ID="imgbtnDelete" ImageUrl="~/images/delete.jpg" OnClientClick="return confirm('Are you sure you want to delete it ?');"
CommandArgument='<%# Eval("UserId") %>' CommandName="DeleteUser" runat="server" />
</ItemTemplate>
</asp:TemplateField>
OR
ImageButton btn = (ImageButton)(e.Row.FindControl("imgbtnDelete"));
btn.Attributes.Add("OnClientClick","funcationToBecalled();")
|
|
|
|
|
Nisha Agrawal wrote: ImageButton btn = (ImageButton)(e.Row.FindControl("imgbtnDelete"));
btn.Attributes.Add("OnClientClick","funcationToBecalled();")
Hmmm, this is also working. Thanks to u too.
|
|
|
|
|
Then Use Only One ..! Not Both...!
If It Helps Click It as Answer
|
|
|
|
|
ofcourse
|
|
|
|
|
Hi
Update panel in asp.net not working on live server but locally working fine.
how can I make this to be running on live server also even AjaxToolKitControl is installed in live server.
thanks
|
|
|
|
|
Fix your deployment. What else can we say ? Work out what is different between the server and local, and fix it. And when you want help, try to define things like 'not working'.
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.
|
|
|
|
|
As CG said .
What Do You Mean By Not Working..!
How It is Not Working..!
If You Explain May the Group will Help..
1
If It Helps Click It as Answer
|
|
|
|
|
1. Used ASP.NET controls: dropdown and textbox.
2. For the 1st time at page load, some default values should be populated in dropdown and 1st value in text box.
Written the below code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DropDownList1.Items.Add("a");
DropDownList1.Items.Add("b");
DropDownList1.Items.Add("c");
TextBox1.Text = DropDownList1.SelectedValue;
}
}
3. Set the autopostback of dropdown=False. So "DropDownList1_SelectedIndexChanged1" will not work. I have done this because after selecting any value in dropdown, post back should not take place.
4. Now we have values in drop down. I want to select a value in dropdown and same selected value should be visible in text box.
I want a java script for this. Not able to write it as not able to find any client event for dropdown.
Actually there is event "onclientclick" for an asp.net button control, but did not find any such event for dropdown.
So how to write java script code.
|
|
|
|
|
BY using ajax, you can get the result.Why dont you try ajax
|
|
|
|
|
Perhaps he cares about writing efficient code that is scalable ?
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
I'm using Calendar.setup to get date in textbox by selecting from calandar in asp.net.
but first time always after loading page it needs to be clicked twice.
but I want calandar on single click on image button.
please find code here:
function showcalander(obj,date)
{
Calendar.setup({
inputField : date, // id of the input field
ifFormat : "%d/%m/%Y", // format of the input field (even if hidden, this format will be honored)
button : obj, // trigger button (well, IMG in our case)
align : "Br", // alignment (defaults to "Bl")
singleClick : true,
: false
});
}
|
|
|
|
|
I think Its Ok With Using .Did U Use For Button Click Like This
<img src="../Img/cal.gif" id="f_triggerDOB_b" onmousedown="initCalc('f_dateDOB_b','f_triggerDOB_b');" />
function initCalc(inputfield,button){
Calendar.setup({
inputField : inputfield,
ifFormat : "%m/%d/%Y %I:%M %p",
showsTime : true,
button : button,
singleClick : true,
step : 1
});
}
But If You r using ajax why to use Third party Control.Did You lokk at this..!
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Calendar/Calendar.aspx[^]
If It Helps Click It as Answer
|
|
|
|