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 uniqueidentifie r for that record. Here is
the HTML for it:
<ASP:BUTTONFIEL D BUTTONTYPE="Ima ge" IMAGEURL="~/images/ViewEmps.gif"
TEXT="Button" DATATEXTFIELD=" EmployeeNumber"
COMMANDNAME="Em playeeDetails">
<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.Redire ct("EmployeeDet ails.aspx?id=" +
button_datatext field_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 3683 gl****@gmail.co m 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 uniqueidentifie r for that record. Here is
the HTML for it:
<ASP:BUTTONFIEL D BUTTONTYPE="Ima ge" IMAGEURL="~/images/ViewEmps.gif"
TEXT="Button" DATATEXTFIELD=" EmployeeNumber"
COMMANDNAME="Em playeeDetails">
<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.Redire ct("EmployeeDet ails.aspx?id=" +
button_datatext field_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("EmployeeN umber") %>' OnClick="OnClic kRedirectButton " />
[Code behind]
protected void OnClickRedirect Button(object sender, EventAgrs e) {
Button btn = sender as Button;
int employeeNum = int.Parse( btn.CommandAgru ment );
Response.Redire ct("EmployeeDet ails.aspx?id=" +employeeNum );
}
I hope this post could help you
--
Duy Lam Phuong
On Nov 26, 11:48 am, Duy Lam <duylamphu...@g mail.comwrote:
glb...@gmail.co m 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 uniqueidentifie r for that record. Here is
the HTML for it:
<ASP:BUTTONFIEL D BUTTONTYPE="Ima ge" IMAGEURL="~/images/ViewEmps.gif"
TEXT="Button" DATATEXTFIELD=" EmployeeNumber"
COMMANDNAME="Em playeeDetails">
<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.Redire ct("EmployeeDet ails.aspx?id=" +
button_datatext field_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("EmployeeN umber") %>' OnClick="OnClic kRedirectButton " />
[Code behind]
protected void OnClickRedirect Button(object sender, EventAgrs e) {
Button btn = sender as Button;
int employeeNum = int.Parse( btn.CommandAgru ment );
Response.Redire ct("EmployeeDet ails.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 "CommandAgrumen t" seems to give only
the row # associated with that button. I need a button that's on a
gridview (<ASP:BUTTONFIE LD BUTTONTYPE="Ima ge") 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.co m wrote:
On Nov 26, 11:48 am, Duy Lam <duylamphu...@g mail.comwrote:
glb...@gmail.co m 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 uniqueidentifie r for that record. Here is
the HTML for it:
<ASP:BUTTONFIEL D BUTTONTYPE="Ima ge" IMAGEURL="~/images/ViewEmps.gif"
TEXT="Button" DATATEXTFIELD=" EmployeeNumber"
COMMANDNAME="Em playeeDetails">
<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.Redire ct("EmployeeDet ails.aspx?id=" +
button_datatext field_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("EmployeeN umber") %>' OnClick="OnClic kRedirectButton " />
[Code behind]
protected void OnClickRedirect Button(object sender, EventAgrs e) {
Button btn = sender as Button;
int employeeNum = int.Parse( btn.CommandAgru ment );
Response.Redire ct("EmployeeDet ails.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 "CommandAgrumen t" seems to give only
the row # associated with that button. I need a button that's on a
gridview (<ASP:BUTTONFIE LD BUTTONTYPE="Ima ge") 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 uniqueidentifie r for that record. Here
is
the HTML for it:
<ASP:BUTTONFIEL D BUTTONTYPE="Ima ge" IMAGEURL="~/images/ViewEmps.gif"
TEXT="Button" DATATEXTFIELD=" EmployeeNumber"
COMMANDNAME="Em playeeDetails">
<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.Redire ct("EmployeeDet ails.aspx?id=" +
button_datatext field_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="E mployeeNumber" on the grid itself, you could do
this:
protected void PaidInvoices_Ro wClicked(object sender,
CustomGridView. GridViewRowClic kedEventArgs args)
{
Response.Redire ct("ViewInvoice .aspx?id=" +
PaidInvoices.Da taKeys[args.Row.RowInd ex].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.Data Keys[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 appropriate based on your
method names .
the GridView has OnRowCommand="GridView1_RowCommand" in the aspx.
my problem is that the RowCommand event is firing twice (95% of the
time) on the page. the other 5% it only fires once. there's no
|
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
called and the GridView is populated. No problems.
When I click the select button in the GridView, I first go to Page_Load and
IsPostBack = true. Therefore, DisplayItems() is not called again. No
problems.
Then the...
|
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 GridView.Visible = True.
I press HIDE and the GridView disappears as expected.
After it I press SHOW and the GridView doesn't show.
|
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 do it. Does anyone know how
to do this?
Thanks in advance,
--Rob Roberts
|
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 page life cycle.
In this example the event fires twice when a) GridView EnableViewState=False
and any image type control in the <columns/> element. When either
EnableViewState is set to true or the image button is removed, the event
fires once....
| |
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 footer template has an commandbutton with the commandname set to
'Insert'.
Both buttons cause postback, however the RowCommand event does not fire.
How can I get the rowcommand to fire?
|
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 something really easy, but I
cannot see it. The stored procedue works when run in QA. Can someone tell me
what I am doing wrong/missing that is keeping the delete command from working
in the gridview? Thank you.
I am trying to delete a row out of...
|
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"
OnRowCreated="ContactHistoryGrid_RowCreated"
CssClass="GridViewTable"
GridLines="None" CellSpacing="1" CellPadding="3" AllowSorting="True"
AllowPaging="True">
<EmptyDataTemplate>
|
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 and also get the datakey (in my case personid) of the the rows selected. Please point me in the right direction. This is what i have so far but i have problem accessing the child gridview in the button click event
Cheers, Shilpa.
<asp:GridView...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |