|
But the original requirement was to able to click on datarow not any control in the gridview row. thats why i have prvovided that code. please read the requirement carefully.
|
|
|
|
|
Nisha Agrawal wrote: please read the requirement carefully.
Please look at all of the requirements. The image clearly shows and says the OP want to click on a LINK
only two letters away from being an asset
|
|
|
|
|
yes, it's my mistake. I just followed the words that were written in the main post and ignored the one in the image.
|
|
|
|
|
Ok, it works, because when I click the link, it has this value
"http://localhost:3849/progetto/visualizza.aspx?IDModello=24," but now to see the data, including other photos in the DataList , how should I proceed?
|
|
|
|
|
|
"IDModello" is a sql int variable.
When I click on the gridview (see the image I posted),I want to appear a DataList with only the data that I want to ... not all!
|
|
|
|
|
Use a Hyperlink column or a Template column to place the link in the grid
only two letters away from being an asset
|
|
|
|
|
<ItemTemplate>
<asp:LinkButton ID ="LinkButtonemp" CausesValidation="false" Text='<%# Eval("EmployeeName") %>' runat="server" CommandArgument='<% #Eval("EmployeeID")%>' CommandName="View" CssClass="gridlnk"/>
</ItemTemplate>
Append the name/ID to the querystring and redirect it to another page say InfoPage.aspx.In info page Request the query String .With the Help of Query String Get the Data in the InfoPage.aspx.
If It Helps Click It as Answer
|
|
|
|
|
Hi,
do changes in frist column(Viewdetails)
<asp:HyperLink ID="hypTitle" NavigateUrl='<%#"secondpage.aspx?pid="+DataBinder.Eval(Container.DataItem,"picid")%>' Text='<%#DataBinder.Eval(Container.DataItem,"picturename") %>' runat="server" ></asp:HyperLink>
when click the viewdetails column, i pass Querystring("pid") value of current picture.
On second page, get value from querystring("pid"), using to display the picture.
|
|
|
|
|
Good Answer But Try to use pre tags i.e. code block so he can understand easily
If It Helps Click It as Answer
|
|
|
|
|
|
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();")
|
|
|
|