Hi,
I posted this question yesterday but didn't get the answer I needed.
I am DESPERATE to get this working so I'm re-posting it because I
don't think I worded it correctly.
I have a GridView which is databound to a table. All the data is
being pulled correctly so there is no problem there.
On each row I have an image button which is attached to a
DataTextField, pulling up a uniqueidentifier for that record. Here is
the HTML for it:
<ASP:BUTTONFIELD BUTTONTYPE="Image" IMAGEURL="~/images/ViewEmps.gif"
TEXT="Button" DATATEXTFIELD="EmployeeNumber"
COMMANDNAME="EmplayeeDetails">
<ITEMSTYLE HORIZONTALALIGN="Center" VERTICALALIGN="Middle"
WRAP="False" />
</ASP:BUTTONFIELD>
When I hover above this button it shows me the correct DataTextField
value for each row. I have the code in place so that when the user
clicks on this button it redirects them to another page. No problem,
everythings fine to this point.
The problem I am having is that I need to get the DATATEXTFIELD value
from the button so I can use it as part of a querystring, such as:
Response.Redirect("EmployeeDetails.aspx?id=" +
button_datatextfield_value)
How can I get this DATATEXTFIELD value? Can anyone help with this?
Again, sorry for the re-post but I, obviously, didn't explain the
problem correctly and I am desperate to get this working since I am
going to be using gridviews on several different pages and am stuck
without it working correctly.
Thanks,
Steve 4 3658 gl****@gmail.com wrote:
Hi,
I posted this question yesterday but didn't get the answer I needed.
I am DESPERATE to get this working so I'm re-posting it because I
don't think I worded it correctly.
I have a GridView which is databound to a table. All the data is
being pulled correctly so there is no problem there.
On each row I have an image button which is attached to a
DataTextField, pulling up a uniqueidentifier for that record. Here is
the HTML for it:
<ASP:BUTTONFIELD BUTTONTYPE="Image" IMAGEURL="~/images/ViewEmps.gif"
TEXT="Button" DATATEXTFIELD="EmployeeNumber"
COMMANDNAME="EmplayeeDetails">
<ITEMSTYLE HORIZONTALALIGN="Center" VERTICALALIGN="Middle"
WRAP="False" />
</ASP:BUTTONFIELD>
When I hover above this button it shows me the correct DataTextField
value for each row. I have the code in place so that when the user
clicks on this button it redirects them to another page. No problem,
everythings fine to this point.
The problem I am having is that I need to get the DATATEXTFIELD value
from the button so I can use it as part of a querystring, such as:
Response.Redirect("EmployeeDetails.aspx?id=" +
button_datatextfield_value)
How can I get this DATATEXTFIELD value? Can anyone help with this?
Again, sorry for the re-post but I, obviously, didn't explain the
problem correctly and I am desperate to get this working since I am
going to be using gridviews on several different pages and am stuck
without it working correctly.
Thanks,
Steve
Maybe i don't understand properly your idea, so my code no usefull for you.
I think you can give data though CommandAgrument attribute from Button
control.
For example:
[Design]
<asp:button text="click here" CommandAgrument='<%#
Eval("EmployeeNumber") %>' OnClick="OnClickRedirectButton" />
[Code behind]
protected void OnClickRedirectButton(object sender, EventAgrs e) {
Button btn = sender as Button;
int employeeNum = int.Parse( btn.CommandAgrument );
Response.Redirect("EmployeeDetails.aspx?id=" +employeeNum );
}
I hope this post could help you
--
Duy Lam Phuong
On Nov 26, 11:48 am, Duy Lam <duylamphu...@gmail.comwrote:
glb...@gmail.com wrote:
Hi,
I posted this question yesterday but didn't get the answer I needed.
I am DESPERATE to get this working so I'm re-posting it because I
don't think I worded it correctly.
I have a GridView which is databound to a table. All the data is
being pulled correctly so there is no problem there.
On each row I have an image button which is attached to a
DataTextField, pulling up a uniqueidentifier for that record. Here is
the HTML for it:
<ASP:BUTTONFIELD BUTTONTYPE="Image" IMAGEURL="~/images/ViewEmps.gif"
TEXT="Button" DATATEXTFIELD="EmployeeNumber"
COMMANDNAME="EmplayeeDetails">
<ITEMSTYLE HORIZONTALALIGN="Center" VERTICALALIGN="Middle"
WRAP="False" />
</ASP:BUTTONFIELD>
When I hover above this button it shows me the correct DataTextField
value for each row. I have the code in place so that when the user
clicks on this button it redirects them to another page. No problem,
everythings fine to this point.
The problem I am having is that I need to get the DATATEXTFIELD value
from the button so I can use it as part of a querystring, such as:
Response.Redirect("EmployeeDetails.aspx?id=" +
button_datatextfield_value)
How can I get this DATATEXTFIELD value? Can anyone help with this?
Again, sorry for the re-post but I, obviously, didn't explain the
problem correctly and I am desperate to get this working since I am
going to be using gridviews on several different pages and am stuck
without it working correctly.
Thanks,
Steve
Maybe i don't understand properly your idea, so my code no usefull for you.
I think you can give data though CommandAgrument attribute from Button
control.
For example:
[Design]
<asp:button text="click here" CommandAgrument='<%#
Eval("EmployeeNumber") %>' OnClick="OnClickRedirectButton" />
[Code behind]
protected void OnClickRedirectButton(object sender, EventAgrs e) {
Button btn = sender as Button;
int employeeNum = int.Parse( btn.CommandAgrument );
Response.Redirect("EmployeeDetails.aspx?id=" +employeeNum );
}
I hope this post could help you
--
Duy Lam Phuong- Hide quoted text -
- Show quoted text -
I appreciate your help. Problem is that there is no "onclick" event
for a button on a gridview and "CommandAgrument" seems to give only
the row # associated with that button. I need a button that's on a
gridview (<ASP:BUTTONFIELD BUTTONTYPE="Image") not a regular button
(<asp:button text="click here"), they seem to work differently. I
need to return (or somehow obtain) the DataTextField value that is
assigned to this button.
Any ideas on how to do this?
Thanks,
Steve
On Nov 26, 12:08 pm, glb...@gmail.com wrote:
On Nov 26, 11:48 am, Duy Lam <duylamphu...@gmail.comwrote:
glb...@gmail.com wrote:
Hi,
I posted this question yesterday but didn't get the answer I needed.
I am DESPERATE to get this working so I'm re-posting it because I
don't think I worded it correctly.
I have a GridView which is databound to a table. All the data is
being pulled correctly so there is no problem there.
On each row I have an image button which is attached to a
DataTextField, pulling up a uniqueidentifier for that record. Here is
the HTML for it:
<ASP:BUTTONFIELD BUTTONTYPE="Image" IMAGEURL="~/images/ViewEmps.gif"
TEXT="Button" DATATEXTFIELD="EmployeeNumber"
COMMANDNAME="EmplayeeDetails">
<ITEMSTYLE HORIZONTALALIGN="Center" VERTICALALIGN="Middle"
WRAP="False" />
</ASP:BUTTONFIELD>
When I hover above this button it shows me the correct DataTextField
value for each row. I have the code in place so that when the user
clicks on this button it redirects them to another page. No problem,
everythings fine to this point.
The problem I am having is that I need to get the DATATEXTFIELD value
from the button so I can use it as part of a querystring, such as:
Response.Redirect("EmployeeDetails.aspx?id=" +
button_datatextfield_value)
How can I get this DATATEXTFIELD value? Can anyone help with this?
Again, sorry for the re-post but I, obviously, didn't explain the
problem correctly and I am desperate to get this working since I am
going to be using gridviews on several different pages and am stuck
without it working correctly.
Thanks,
Steve
Maybe i don't understand properly your idea, so my code no usefull for you.
I think you can give data though CommandAgrument attribute from Button
control.
For example:
[Design]
<asp:button text="click here" CommandAgrument='<%#
Eval("EmployeeNumber") %>' OnClick="OnClickRedirectButton" />
[Code behind]
protected void OnClickRedirectButton(object sender, EventAgrs e) {
Button btn = sender as Button;
int employeeNum = int.Parse( btn.CommandAgrument );
Response.Redirect("EmployeeDetails.aspx?id=" +employeeNum );
}
I hope this post could help you
--
Duy Lam Phuong- Hide quoted text -
- Show quoted text -
I appreciate your help. Problem is that there is no "onclick" event
for a button on a gridview and "CommandAgrument" seems to give only
the row # associated with that button. I need a button that's on a
gridview (<ASP:BUTTONFIELD BUTTONTYPE="Image") not a regular button
(<asp:button text="click here"), they seem to work differently. I
need to return (or somehow obtain) the DataTextField value that is
assigned to this button.
Any ideas on how to do this?
Thanks,
Steve- Hide quoted text -
- Show quoted text -
Come on, someone, anyone? There has GOT to be a way to do this but I
cannot figure out how. Someone must have done this before.
On each row I have an image button which is attached to a
DataTextField, pulling up a uniqueidentifier for that record. Here
is
the HTML for it:
<ASP:BUTTONFIELD BUTTONTYPE="Image" IMAGEURL="~/images/ViewEmps.gif"
TEXT="Button" DATATEXTFIELD="EmployeeNumber"
COMMANDNAME="EmplayeeDetails">
<ITEMSTYLE HORIZONTALALIGN="Center" VERTICALALIGN="Middle"
WRAP="False" />
</ASP:BUTTONFIELD>
When I hover above this button it shows me the correct DataTextField
value for each row. I have the code in place so that when the user
clicks on this button it redirects them to another page. No problem,
everythings fine to this point.
The problem I am having is that I need to get the DATATEXTFIELD value
from the button so I can use it as part of a querystring, such as:
Response.Redirect("EmployeeDetails.aspx?id=" +
button_datatextfield_value)
You say that the value in DATATEXTFIELD is a unique identifier for the row.
And you are able to get the row number in your event handler. So assuming
you have DataKeyNames="EmployeeNumber" on the grid itself, you could do
this:
protected void PaidInvoices_RowClicked(object sender,
CustomGridView.GridViewRowClickedEventArgs args)
{
Response.Redirect("ViewInvoice.aspx?id=" +
PaidInvoices.DataKeys[args.Row.RowIndex].Value.ToString(), true);
}
We use a custom grid view derived from the basic grid view so the event name
and command args are different, but you should get the idea. Basically you
want to inspect "GridView1.DataKeys[rownumber].Value".
Scott This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tim_Mac |
last post by:
hi,
i'm new to .net 2.0, and am just starting to get to grips with the
gridview.
my page has autoEventWireUp set to true, which i gather is supposed to
figure out which handlers to invoke when...
|
by: tacmec |
last post by:
ASP.NET 2.0 (C#) application. I have a web form with a GridView, which is
populated dynamically. See the code below.
First time to the page, IsPostBack is false. Therefore, DisplayItems() is...
|
by: Miguel Dias Moura |
last post by:
Hello,
I have a GridView in my page which is created in runtime. It works fine.
My page has 2 Asp Buttons:
- The HIDE button makes GridView.Visible = False;
- The SHOW button makes...
|
by: Rob Roberts |
last post by:
I am trying to figure out a way to add onmouseover and onmouseout events to
ButtonFields in a GridView in order to give them a rollover effect, but so
far I haven't been able to figure out a way to...
|
by: J055 |
last post by:
Hi
I have a very simple configuration of the GridView with paging and sorting.
When I do a postback the DataBinding event fires twice - in both the
ProcessPostData and PreRender stages of the...
| |
by: AG |
last post by:
I have a gridview that I bind to a List(of Type) at runtime.
Not using a datasource control.
The gridview has a template column with an imagebutton whose commandname is
set to 'Delete'.
The...
|
by: Wannabe |
last post by:
I am using ASP.Net 2.0 and have a gridview on my page. I have everything
working except the delete command. The page reloads except the row I am
trying to delete is still there. I believe it is...
|
by: Evan M. |
last post by:
Here's my GridView and my SqlDataSource
<asp:GridView ID="ContactHistoryGrid" runat="server"
AutoGenerateColumns="False" DataSourceID="ContactHistoryDS"
DataKeyNames="JobHistoryID"...
|
by: sharonrao123 |
last post by:
hello all,
I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |