| Capture hyperlink text property |
|
 |
Index ‹ dotnet-framework-aspnet
|
- Previous
- 1
- Conditional display of web page elementI have a few things such as buttons and URLs that may or may not be shown
based on the value of a database column. I can hook to the database and get
the dataset and datarecord just fine. I can retrieve the value into a
variable fine. My problem is that I have no idea what code to use to tell a
button not to be displayed if I don't get a certain value. In ASP I would
just embed VBScript to check the value of the variable in an if then and
either include the button or skip it on the fly. I can't seem to figure out
how to do this in ASP.NET.
Would someone please help me out with a code sample or a pointer to where
this is explained?
- 1
- nested dropdownlist loses values - only in one instanceI have a page that has two copies of the same control in it. The
control is:
BorrowerControl
the two references to it in the page are
bControl1
cobControl1
The control contains a dropdownlist that is populated from xml. I only
bind this data on page_load, not on subsequent postbacks (shouldn't
need to). Code to bind (where this.States is a dataset on the page)
is:
foreach(DataRow d in this.States.Tables[0].Rows)
{
string txt = d["abv"].ToString();
string val = d["abv"].ToString();
li = new ListItem(txt, val);
control.Items.Add(li);
}
control.DataBind();
I'm getting some REALLY strange behavior. The dropdownlist in
bControl1 maintains its values on postback, but the dropdownlist in
cobControl1 does not. I haven't found anything that says I can't have
multiple copies of the same control on the page, or that would explain
this type of erratic behavior. Can someone shed some light on this
situation? I can provide more detail if necessary. And no, I don't
have enableViewState = false on either instance of the control.
Sincerely,
Bryan Ax
- 2
- Hold key to keep the message box before redirecting to a new page (ASP.NET program)Hi all,
I have a problem in ASP.NET program (Web pdevelopment). In VB Sub function,
I want to dipslay a message box. The next line of my code is to
response.redirect to the next page. My problem is the program skipped to
display the message box, but only redirected to the new page. I'd like to
use a key to hold the message box and after press that key it will redirect
to the next page. Can I do that in ASP.NET ? Please help.
Thanks in advance.
- 4
- Why does button_click create duplicate webform ?"Lee Holsenbeck" <email***@***.com> wrote in message
news:email***@***.com...
> hi,
>
> i have a button_click event that reads selections from 1 listbox and moves
them to a second listbox, but when i click on the button; it creates a
duplicate of the current webforms and display the results in the duplicate.
> what setting have i changed/am i missing to make it repost back to the
current webform ?
Lee, please narrow this down to a small reproducer and post the code here.
I don't know of any reason why there would be a duplicate web form. In fact,
I don't know what you mean when you say "duplicate web form".
--
John Saunders
johnwsaundersiii at hotmail
- 5
- AddHandler VB.NET and ASP.NETHi,
I have created a simple Web User Control. It dynamically creates a table.
With a cell in the table, it creates a Button control set to run at the
server. I then call AddHandler and handle the Click event from the button
and raise it as an event within my User Control. This seems to be
happening, so much as it getting the RaiseEvent line, but it just does not
raise the event. There are no errors, it just carries on executing.
Is there an issue with dynamically adding controls to a user control and
wrapping their events in a single event in a User Control using VB.NET in
ASP.NET? If not, can someone post a sample on how to do so?
L.
- 6
- Picture Portfollio (asp.net 2.0 using vb.net)Hello,
I was asked to build an internal site to show pictures of events that we
have had. What I was thinking about doing is loading the files in a
directory and then pulling the names in the directory into a gridview or
repeater control. My question is how woud I go about getting the names of
the files into an array. And how can I show the pictures going across the
multiple columns instead of just one column?
--
Thanks in advance,
sck10
- 7
- The request failed with HTTP status 502: Bad GatewayHi:
I have a running application built in VS2003 and using Net Framework
1.1. I recently upgraded to VS2005 and converted the project to use
2.0 Framework.
My call to the web service gives me "The request failed with HTTP
status 502: Bad Gateway".
Is there any special setting I need to do while calling a web service?
Any and All help will be appreciated.
Thanks,
Murad
- 9
- 9
- network (drive) access/impersonate identity problemI am experiencing difficulty access a mapped network drive in an ASP.NET
application.
While using the .Net framework v 1.1 implementation of
System.IO.Directory.Exists(), it fails to recognize a mapped network drive.
This is true if the path specified uses a mapped drive letter or is
expressed as a UNC address. I have also tried the drive letter and UNC
paths with and without trailing backslashes, respectively.
No luck with ASP.NET, but it does work when I create a simple C# console
test harness application. This indicates to me to be a security concern with
ASP.NET. Funny thing is - no exception is returned. For all combinations,
System.IO.Directory.Exists returns false. (If so, this behavior is very
inconsistent with the System.Security thrown for things like trying to write
to a file, execute code on another machine, etc.)
The following knowledge base article:
307901: INFO: Permissions to Connect to a Remote Access Database from
ASP.NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;307901&Product=aspnet
recommends using impersonation, but an error occurs even before the 1st line
of my ASP.NET code is executed.
No windows event is logged either.
How do I get the ASP.NET worker process to recognize another machine's hard
drive, folders and files?
Any help is appreciated. Thanks!
--
Peter O'Reilly
- 11
- How to do screen scraping where the site requires a log inHello,
I would like to pull some information off a site that requires a log in.
I have a subscription to a premium content site, and I would like to be
able to do a few automatic requests instead of having to load the site
manually in a browser.
I have seen plenty articles that explain how to do screen scraping in
.NET, others that describe how to do it via a POST, but I couldn't find
any that covered my scenario.
Basically the problem is that the code would first have to call the home
page, then fill in the log in entries and post the page back. Then, the
code would need to hang on to the cookie (which is what I assume they
are using) so that when it does another request (GET would be fine
here), the site will allow the request and not think the requester is
not logged in.
This all works fine in a browser, as the browser handles the cookie for
you, but the code examples I have seen seem to use completely stateless
requests (ie no cookies preserved), so it wouldn't work for a site like
this.
Any ideas? TIA
--
Alan Silver
(anything added below this line is nothing to do with me)
- 11
- Webservice serve multiple request at same time ??having a webservice X in seperate server and two application A & B on
each seperate server, where application A and B access the same method
from webservice X
wheather webservice provide service for both application at same time
or it will service for application A first(After completion) Then
application b .
Can any one explain me
Regards
Prakash
- 11
- Sub - what is the parameter typeI have the sub that is checking if value from the datareader is null. I
would like to pass textbox.text or dropdownbox.selectedvalue as first
parameter and value from data reader as a second parameter.
I cannot figure out what type is first parameter. (I am using ASP since
2 weeks and I don't know where to look for this kind of information)
Below is my sub. I would like to pass textbox.text(or
checkbox.selectedvalue) as objectname and datareader(data) as value.
Private Sub Check_Null(ByVal objectname As System.Object, ByVal value As
Object)
If IsDBNull(value) Then
objectname = ""
Else
objectname = value
Status.Text = objectname
End If
End Sub
Thank you
Arek
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- 15
- How/Where the OldValuesParameters is retrived from?<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="......." SelectCommand="SELECT * FROM [MyData]"
ConflictDetection="CompareAllValues" DeleteCommand="DELETE FROM [MyData]
WHERE [ID] = @original_ID AND [last_mod_time] = @original_last_mod_time "
OldValuesParameterFormatString="original_{0}">
<DeleteParameters>
<asp:Parameter Name="original_EID" Type="Int32" />
<asp:Parameter Name="original_last_mod_time" Type="DateTime" />
</DeleteParameters>
</asp:SqlDataSource>
with a FormView bound to that datasource(DataKey is ID), in the
ItemTemplate, there is no control that is bound from ID, nor Last_mod_time
but when deleteing, it fail to delete correctly, because the
@original_last_mod_time was empty(the viewing data has a last_mod_time),
while @original_ID has the correctID in it
so my question is, WHERE does the @original_ID come from? and why
@original_last_mod_time was empty?
thanks.
- 15
- Problem with adding UserControls programtic in the OnPreRender event and still keep the UC viewState(ASP.NET 1.1)
Hi
I have a problem with my ViewStates in a userControl. The problem is that
the ViewState is not "writte" og changed if you like after editing in my
case a textbox.
This is the code I use to add the User controll
Control Component1 = null;
Component1 = LoadControl("MyUC.ascx");
((MyUC)Component1).RapId = 0;
PlaceHolderForComponents.Controls.Add(Component1);
The UserControl contains some textboxes wich is viewstateenabled and
autopostbacks.
If i change the value in one of these textboxes in the UC and the above code
is placed in Page_Load every thing works fine, but if i place it in the
OnPreRender event all my change to my textboxes is discarded.
I simply Cant see why this should make the change disapear and i really hope
someone has a solution.
Best reagards
Anders, DK
- 15
- Need to create Eventhandler for control created at runtimeHi,
At what point in the page lifecycle are you adding these controls? Are they
part of a control which is databound or are they part of a control which
responds to a postback?
--
Ben
http://bitarray.co.uk/ben
"Jeff" <email***@***.com> wrote in message
news:email***@***.com...
>I have created an array of buttons at run time and need to associate them
> with a
> click event. Below I have included the code used to create the controls at
> run time and hook up the button with the event:
>
> //create array of Update buttons
> intLeft=16;
> intTop=600;
> for(intElement1=0;intElement1<datResults.Tables[0].Rows.Count;intElement1++)
> {
> btnUpdate[intElement1]=new Button();
> btnUpdate[intElement1].Style["Position"]="Absolute";
> btnUpdate[intElement1].Style["Top"]=System.Convert.ToString(intTop) +
> "px";
> btnUpdate[intElement1].Style["Left"]=System.Convert.ToString(intLeft) +
> "px";
> btnUpdate[intElement1].Text="Update";
> btnUpdate[intElement1].Height=21;
> btnUpdate[intElement1].Width=60;
> btnUpdate[intElement1].Click+=new System.EventHandler(this.UpdateClick);
> this.FindControl("WebForm1").Controls.Add(btnUpdate[intElement1]);
> btnUpdate[intElement1].Visible=true;
> intTop+=106;
> }
>
> I have added the following routine as the event:
>
> public void UpdateClick(Object sender, EventArgs e)
> {
> lblError.Visible=true;
> lblError.Text="It worked";
> }
>
> The code in the click routine does not run when the button is clicked. Can
> anyone tell me what I am missing? Thanks in advance.
>
> Regards,
> Jeff
|
| Author |
Message |
Sm9l

|
Posted: 2005-10-26 1:37:02 |
Top |
dotnet-framework-aspnet, Capture hyperlink text property
I have an aspx page (referred to here as page_1) with a datagrid whose first
column contains hyperlinks. When a user clicks one of these hyperlinks, he
will navigate to another aspx page (referred to here as page_2). I need to
cache the value of the link's text (hyperlink.text property) so that I can
use it in the page_load event of page_2.
I've thought of using a hidden field and then calling
Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
don't know is how to populate the hdnClickedLinkText field on page_1 when the
hyperlink is clicked. I've thought about using AddHandler but there is no
exposed click event for the hyperlink control. I could design a custom class
which inherits from the hyperlink class and implement my own Click event, but
this seems a bit much when a simpler solution may exist.
Does anyone have any other ideas?
TIA,
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Q3VydF9DIFtNVlBd

|
Posted: 2005-10-26 1:59:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
is this a standard HREF or does it have a postback? If it's a standard HREF
you will have to pass the call to some clientside code, passing in the text,
and then processing it and redirecting. If it's a postback you can get the
info more easily but more importantly you can do what you want/need with it
then (session value, querystring, etc).
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
"Joe" wrote:
> I have an aspx page (referred to here as page_1) with a datagrid whose first
> column contains hyperlinks. When a user clicks one of these hyperlinks, he
> will navigate to another aspx page (referred to here as page_2). I need to
> cache the value of the link's text (hyperlink.text property) so that I can
> use it in the page_load event of page_2.
>
> I've thought of using a hidden field and then calling
> Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> don't know is how to populate the hdnClickedLinkText field on page_1 when the
> hyperlink is clicked. I've thought about using AddHandler but there is no
> exposed click event for the hyperlink control. I could design a custom class
> which inherits from the hyperlink class and implement my own Click event, but
> this seems a bit much when a simpler solution may exist.
>
> Does anyone have any other ideas?
>
> TIA,
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Sm9l

|
Posted: 2005-10-26 2:15:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Standard HREF; there is no postback. page_1 and page_2 are two different
pages.
Each href looks something like: href="page_2.aspx?q1=value1&q2=value2" where
value1 and value2 change from link to link.
Also, I do not have the option to pass the text property in the querystring.
page_2 merely needs the value of the hyperlink's text. I can handle the
processing once I've got it. I just don't know how to get it.
So, any ideas?
For example, how would you "pass the call to some clientside code, passing
in the text?"
Thanks,
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
> is this a standard HREF or does it have a postback? If it's a standard HREF
> you will have to pass the call to some clientside code, passing in the text,
> and then processing it and redirecting. If it's a postback you can get the
> info more easily but more importantly you can do what you want/need with it
> then (session value, querystring, etc).
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
>
>
> "Joe" wrote:
>
> > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > will navigate to another aspx page (referred to here as page_2). I need to
> > cache the value of the link's text (hyperlink.text property) so that I can
> > use it in the page_load event of page_2.
> >
> > I've thought of using a hidden field and then calling
> > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > hyperlink is clicked. I've thought about using AddHandler but there is no
> > exposed click event for the hyperlink control. I could design a custom class
> > which inherits from the hyperlink class and implement my own Click event, but
> > this seems a bit much when a simpler solution may exist.
> >
> > Does anyone have any other ideas?
> >
> > TIA,
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
RWx0b24gVw

|
Posted: 2005-10-26 3:51:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Hi Joe,
Two solutions:
1. Still use Hyperlink column in the datagrid, but add something in
datagrid_itemDatabound event:
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
link.NavigateUrl += "&text=" + link.Text;
}
Then in page2, you can retrieve it from querystring.
2. Change Hyperlink column to LinkButton. Then you can process in
datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
redirect to page2.
HTH
Elton Wang
"Joe" wrote:
> I have an aspx page (referred to here as page_1) with a datagrid whose first
> column contains hyperlinks. When a user clicks one of these hyperlinks, he
> will navigate to another aspx page (referred to here as page_2). I need to
> cache the value of the link's text (hyperlink.text property) so that I can
> use it in the page_load event of page_2.
>
> I've thought of using a hidden field and then calling
> Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> don't know is how to populate the hdnClickedLinkText field on page_1 when the
> hyperlink is clicked. I've thought about using AddHandler but there is no
> exposed click event for the hyperlink control. I could design a custom class
> which inherits from the hyperlink class and implement my own Click event, but
> this seems a bit much when a simpler solution may exist.
>
> Does anyone have any other ideas?
>
> TIA,
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Sm9l

|
Posted: 2005-10-26 3:58:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Thanks Elton. I can't use the QueryString due to Business Requirements. How
do I cast the Hyperlink column in the datagrid to a link button?
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Elton W" wrote:
> Hi Joe,
>
> Two solutions:
> 1. Still use Hyperlink column in the datagrid, but add something in
> datagrid_itemDatabound event:
>
> if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> ListItemType.AlternatingItem)
> {
> HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> link.NavigateUrl += "&text=" + link.Text;
> }
>
> Then in page2, you can retrieve it from querystring.
>
> 2. Change Hyperlink column to LinkButton. Then you can process in
> datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> redirect to page2.
>
>
> HTH
>
> Elton Wang
>
> "Joe" wrote:
>
> > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > will navigate to another aspx page (referred to here as page_2). I need to
> > cache the value of the link's text (hyperlink.text property) so that I can
> > use it in the page_load event of page_2.
> >
> > I've thought of using a hidden field and then calling
> > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > hyperlink is clicked. I've thought about using AddHandler but there is no
> > exposed click event for the hyperlink control. I could design a custom class
> > which inherits from the hyperlink class and implement my own Click event, but
> > this seems a bit much when a simpler solution may exist.
> >
> > Does anyone have any other ideas?
> >
> > TIA,
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Q3VydF9DIFtNVlBd

|
Posted: 2005-10-26 4:03:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
without postback and without querystring you are limited. I would say try the
javascript call.
add an onClick to the HREF to a javascript function, passing in the text and
URL.
Have the javascript function save this to a session item, then redirect to
the URL.
Plenty of samples of this out there...
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
"Joe" wrote:
> Standard HREF; there is no postback. page_1 and page_2 are two different
> pages.
>
> Each href looks something like: href="page_2.aspx?q1=value1&q2=value2" where
> value1 and value2 change from link to link.
>
> Also, I do not have the option to pass the text property in the querystring.
>
> page_2 merely needs the value of the hyperlink's text. I can handle the
> processing once I've got it. I just don't know how to get it.
>
> So, any ideas?
>
> For example, how would you "pass the call to some clientside code, passing
> in the text?"
>
> Thanks,
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>
>
> "Curt_C [MVP]" wrote:
>
> > is this a standard HREF or does it have a postback? If it's a standard HREF
> > you will have to pass the call to some clientside code, passing in the text,
> > and then processing it and redirecting. If it's a postback you can get the
> > info more easily but more importantly you can do what you want/need with it
> > then (session value, querystring, etc).
> >
> > --
> > Curt Christianson
> > site: http://www.darkfalz.com
> > blog: http://blog.darkfalz.com
> >
> >
> >
> > "Joe" wrote:
> >
> > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > will navigate to another aspx page (referred to here as page_2). I need to
> > > cache the value of the link's text (hyperlink.text property) so that I can
> > > use it in the page_load event of page_2.
> > >
> > > I've thought of using a hidden field and then calling
> > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > exposed click event for the hyperlink control. I could design a custom class
> > > which inherits from the hyperlink class and implement my own Click event, but
> > > this seems a bit much when a simpler solution may exist.
> > >
> > > Does anyone have any other ideas?
> > >
> > > TIA,
> > > --
> > > Joe
> > >
> > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Sm9l

|
Posted: 2005-10-26 4:12:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
I have been looking at samples for over an hour and haven't found one that
shows how to retrieve the text. Do you know how? The URL is easy; the text
is a mystery....
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
> without postback and without querystring you are limited. I would say try the
> javascript call.
> add an onClick to the HREF to a javascript function, passing in the text and
> URL.
> Have the javascript function save this to a session item, then redirect to
> the URL.
>
> Plenty of samples of this out there...
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
>
>
> "Joe" wrote:
>
> > Standard HREF; there is no postback. page_1 and page_2 are two different
> > pages.
> >
> > Each href looks something like: href="page_2.aspx?q1=value1&q2=value2" where
> > value1 and value2 change from link to link.
> >
> > Also, I do not have the option to pass the text property in the querystring.
> >
> > page_2 merely needs the value of the hyperlink's text. I can handle the
> > processing once I've got it. I just don't know how to get it.
> >
> > So, any ideas?
> >
> > For example, how would you "pass the call to some clientside code, passing
> > in the text?"
> >
> > Thanks,
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Curt_C [MVP]" wrote:
> >
> > > is this a standard HREF or does it have a postback? If it's a standard HREF
> > > you will have to pass the call to some clientside code, passing in the text,
> > > and then processing it and redirecting. If it's a postback you can get the
> > > info more easily but more importantly you can do what you want/need with it
> > > then (session value, querystring, etc).
> > >
> > > --
> > > Curt Christianson
> > > site: http://www.darkfalz.com
> > > blog: http://blog.darkfalz.com
> > >
> > >
> > >
> > > "Joe" wrote:
> > >
> > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > use it in the page_load event of page_2.
> > > >
> > > > I've thought of using a hidden field and then calling
> > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > exposed click event for the hyperlink control. I could design a custom class
> > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > this seems a bit much when a simpler solution may exist.
> > > >
> > > > Does anyone have any other ideas?
> > > >
> > > > TIA,
> > > > --
> > > > Joe
> > > >
> > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
RWx0b24gVw

|
Posted: 2005-10-26 4:26:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
No you can't cast Hyperlink to link button. You should change HyperLinkColumn
to ButtonColumn (ButtonType=LinkButton). Then you can do your logic in
datagrid_ItemCommand event on server-side.
HTH
Elton
"Joe" wrote:
> Thanks Elton. I can't use the QueryString due to Business Requirements. How
> do I cast the Hyperlink column in the datagrid to a link button?
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>
>
> "Elton W" wrote:
>
> > Hi Joe,
> >
> > Two solutions:
> > 1. Still use Hyperlink column in the datagrid, but add something in
> > datagrid_itemDatabound event:
> >
> > if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> > ListItemType.AlternatingItem)
> > {
> > HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> > link.NavigateUrl += "&text=" + link.Text;
> > }
> >
> > Then in page2, you can retrieve it from querystring.
> >
> > 2. Change Hyperlink column to LinkButton. Then you can process in
> > datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> > redirect to page2.
> >
> >
> > HTH
> >
> > Elton Wang
> >
> > "Joe" wrote:
> >
> > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > will navigate to another aspx page (referred to here as page_2). I need to
> > > cache the value of the link's text (hyperlink.text property) so that I can
> > > use it in the page_load event of page_2.
> > >
> > > I've thought of using a hidden field and then calling
> > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > exposed click event for the hyperlink control. I could design a custom class
> > > which inherits from the hyperlink class and implement my own Click event, but
> > > this seems a bit much when a simpler solution may exist.
> > >
> > > Does anyone have any other ideas?
> > >
> > > TIA,
> > > --
> > > Joe
> > >
> > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Q3VydF9DIFtNVlBd

|
Posted: 2005-10-26 4:38:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
you misunderstood.. you have to PASS the text to the function.
In otherwords you need to write the text into the onClick function as well
as to the screen.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
"Joe" wrote:
> I have been looking at samples for over an hour and haven't found one that
> shows how to retrieve the text. Do you know how? The URL is easy; the text
> is a mystery....
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>
>
> "Curt_C [MVP]" wrote:
>
> > without postback and without querystring you are limited. I would say try the
> > javascript call.
> > add an onClick to the HREF to a javascript function, passing in the text and
> > URL.
> > Have the javascript function save this to a session item, then redirect to
> > the URL.
> >
> > Plenty of samples of this out there...
> >
> > --
> > Curt Christianson
> > site: http://www.darkfalz.com
> > blog: http://blog.darkfalz.com
> >
> >
> >
> > "Joe" wrote:
> >
> > > Standard HREF; there is no postback. page_1 and page_2 are two different
> > > pages.
> > >
> > > Each href looks something like: href="page_2.aspx?q1=value1&q2=value2" where
> > > value1 and value2 change from link to link.
> > >
> > > Also, I do not have the option to pass the text property in the querystring.
> > >
> > > page_2 merely needs the value of the hyperlink's text. I can handle the
> > > processing once I've got it. I just don't know how to get it.
> > >
> > > So, any ideas?
> > >
> > > For example, how would you "pass the call to some clientside code, passing
> > > in the text?"
> > >
> > > Thanks,
> > > --
> > > Joe
> > >
> > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > >
> > >
> > > "Curt_C [MVP]" wrote:
> > >
> > > > is this a standard HREF or does it have a postback? If it's a standard HREF
> > > > you will have to pass the call to some clientside code, passing in the text,
> > > > and then processing it and redirecting. If it's a postback you can get the
> > > > info more easily but more importantly you can do what you want/need with it
> > > > then (session value, querystring, etc).
> > > >
> > > > --
> > > > Curt Christianson
> > > > site: http://www.darkfalz.com
> > > > blog: http://blog.darkfalz.com
> > > >
> > > >
> > > >
> > > > "Joe" wrote:
> > > >
> > > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > > use it in the page_load event of page_2.
> > > > >
> > > > > I've thought of using a hidden field and then calling
> > > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > > exposed click event for the hyperlink control. I could design a custom class
> > > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > > this seems a bit much when a simpler solution may exist.
> > > > >
> > > > > Does anyone have any other ideas?
> > > > >
> > > > > TIA,
> > > > > --
> > > > > Joe
> > > > >
> > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Sm9l

|
Posted: 2005-10-26 19:49:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Curt,
I did not misunderstand. I can't PASS the text if I can't RETRIEVE the text.
I have tried the following javascript:
function parseHyperlinkId(o) {
alert("Thomas Jefferson was a hack!");
alert(o.text);
alert(o.href);
alert(o.target);
}
Using the following Server side code to link the hyperlink's onClick event
to the javascript:
hLink.Attributes.Add("onClick", "return parseHyperlinkId(this);")
The works fine except that o.text returns "undefined." Do you know why? Do
you know how to retrieve the text from the link? Which property I should
use? Do you know what's wrong with my code?
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
> you misunderstood.. you have to PASS the text to the function.
> In otherwords you need to write the text into the onClick function as well
> as to the screen.
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
>
>
> "Joe" wrote:
>
> > I have been looking at samples for over an hour and haven't found one that
> > shows how to retrieve the text. Do you know how? The URL is easy; the text
> > is a mystery....
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Curt_C [MVP]" wrote:
> >
> > > without postback and without querystring you are limited. I would say try the
> > > javascript call.
> > > add an onClick to the HREF to a javascript function, passing in the text and
> > > URL.
> > > Have the javascript function save this to a session item, then redirect to
> > > the URL.
> > >
> > > Plenty of samples of this out there...
> > >
> > > --
> > > Curt Christianson
> > > site: http://www.darkfalz.com
> > > blog: http://blog.darkfalz.com
> > >
> > >
> > >
> > > "Joe" wrote:
> > >
> > > > Standard HREF; there is no postback. page_1 and page_2 are two different
> > > > pages.
> > > >
> > > > Each href looks something like: href="page_2.aspx?q1=value1&q2=value2" where
> > > > value1 and value2 change from link to link.
> > > >
> > > > Also, I do not have the option to pass the text property in the querystring.
> > > >
> > > > page_2 merely needs the value of the hyperlink's text. I can handle the
> > > > processing once I've got it. I just don't know how to get it.
> > > >
> > > > So, any ideas?
> > > >
> > > > For example, how would you "pass the call to some clientside code, passing
> > > > in the text?"
> > > >
> > > > Thanks,
> > > > --
> > > > Joe
> > > >
> > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > >
> > > >
> > > > "Curt_C [MVP]" wrote:
> > > >
> > > > > is this a standard HREF or does it have a postback? If it's a standard HREF
> > > > > you will have to pass the call to some clientside code, passing in the text,
> > > > > and then processing it and redirecting. If it's a postback you can get the
> > > > > info more easily but more importantly you can do what you want/need with it
> > > > > then (session value, querystring, etc).
> > > > >
> > > > > --
> > > > > Curt Christianson
> > > > > site: http://www.darkfalz.com
> > > > > blog: http://blog.darkfalz.com
> > > > >
> > > > >
> > > > >
> > > > > "Joe" wrote:
> > > > >
> > > > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > > > use it in the page_load event of page_2.
> > > > > >
> > > > > > I've thought of using a hidden field and then calling
> > > > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > > > exposed click event for the hyperlink control. I could design a custom class
> > > > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > > > this seems a bit much when a simpler solution may exist.
> > > > > >
> > > > > > Does anyone have any other ideas?
> > > > > >
> > > > > > TIA,
> > > > > > --
> > > > > > Joe
> > > > > >
> > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Sm9l

|
Posted: 2005-10-26 19:51:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Thank you, thank you, thank you, thank you.
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Elton W" wrote:
> No you can't cast Hyperlink to link button. You should change HyperLinkColumn
> to ButtonColumn (ButtonType=LinkButton). Then you can do your logic in
> datagrid_ItemCommand event on server-side.
>
> HTH
>
> Elton
>
> "Joe" wrote:
>
> > Thanks Elton. I can't use the QueryString due to Business Requirements. How
> > do I cast the Hyperlink column in the datagrid to a link button?
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Elton W" wrote:
> >
> > > Hi Joe,
> > >
> > > Two solutions:
> > > 1. Still use Hyperlink column in the datagrid, but add something in
> > > datagrid_itemDatabound event:
> > >
> > > if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> > > ListItemType.AlternatingItem)
> > > {
> > > HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> > > link.NavigateUrl += "&text=" + link.Text;
> > > }
> > >
> > > Then in page2, you can retrieve it from querystring.
> > >
> > > 2. Change Hyperlink column to LinkButton. Then you can process in
> > > datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> > > redirect to page2.
> > >
> > >
> > > HTH
> > >
> > > Elton Wang
> > >
> > > "Joe" wrote:
> > >
> > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > use it in the page_load event of page_2.
> > > >
> > > > I've thought of using a hidden field and then calling
> > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > exposed click event for the hyperlink control. I could design a custom class
> > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > this seems a bit much when a simpler solution may exist.
> > > >
> > > > Does anyone have any other ideas?
> > > >
> > > > TIA,
> > > > --
> > > > Joe
> > > >
> > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Sm9l

|
Posted: 2005-10-26 20:03:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Elton,
The ItemCommand is not firing. Here is my code:
Private Sub dgForms_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgForms.ItemCommand
hdnFormNumber.Value = CType(e.Item.Cells(0).Controls(0), LinkButton).Text
End Sub
I've had this problem before with the SortCommand, but don't quite know how
to resolve it. Do you have any ideas why this wouldn't fire?
Joe
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Elton W" wrote:
> No you can't cast Hyperlink to link button. You should change HyperLinkColumn
> to ButtonColumn (ButtonType=LinkButton). Then you can do your logic in
> datagrid_ItemCommand event on server-side.
>
> HTH
>
> Elton
>
> "Joe" wrote:
>
> > Thanks Elton. I can't use the QueryString due to Business Requirements. How
> > do I cast the Hyperlink column in the datagrid to a link button?
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Elton W" wrote:
> >
> > > Hi Joe,
> > >
> > > Two solutions:
> > > 1. Still use Hyperlink column in the datagrid, but add something in
> > > datagrid_itemDatabound event:
> > >
> > > if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> > > ListItemType.AlternatingItem)
> > > {
> > > HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> > > link.NavigateUrl += "&text=" + link.Text;
> > > }
> > >
> > > Then in page2, you can retrieve it from querystring.
> > >
> > > 2. Change Hyperlink column to LinkButton. Then you can process in
> > > datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> > > redirect to page2.
> > >
> > >
> > > HTH
> > >
> > > Elton Wang
> > >
> > > "Joe" wrote:
> > >
> > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > use it in the page_load event of page_2.
> > > >
> > > > I've thought of using a hidden field and then calling
> > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > exposed click event for the hyperlink control. I could design a custom class
> > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > this seems a bit much when a simpler solution may exist.
> > > >
> > > > Does anyone have any other ideas?
> > > >
> > > > TIA,
> > > > --
> > > > Joe
> > > >
> > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
RWx0b24gVw

|
Posted: 2005-10-26 22:20:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Check the datagrid's EnableViewState, if it's false, enable it. Disabled
EnableViewState causes datagrid not function properly.
HTH
Elton
"Joe" wrote:
> Elton,
>
> The ItemCommand is not firing. Here is my code:
>
> Private Sub dgForms_ItemCommand(ByVal source As Object, ByVal e As
> System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
> dgForms.ItemCommand
>
> hdnFormNumber.Value = CType(e.Item.Cells(0).Controls(0), LinkButton).Text
> End Sub
>
> I've had this problem before with the SortCommand, but don't quite know how
> to resolve it. Do you have any ideas why this wouldn't fire?
>
> Joe
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>
>
> "Elton W" wrote:
>
> > No you can't cast Hyperlink to link button. You should change HyperLinkColumn
> > to ButtonColumn (ButtonType=LinkButton). Then you can do your logic in
> > datagrid_ItemCommand event on server-side.
> >
> > HTH
> >
> > Elton
> >
> > "Joe" wrote:
> >
> > > Thanks Elton. I can't use the QueryString due to Business Requirements. How
> > > do I cast the Hyperlink column in the datagrid to a link button?
> > > --
> > > Joe
> > >
> > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > >
> > >
> > > "Elton W" wrote:
> > >
> > > > Hi Joe,
> > > >
> > > > Two solutions:
> > > > 1. Still use Hyperlink column in the datagrid, but add something in
> > > > datagrid_itemDatabound event:
> > > >
> > > > if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> > > > ListItemType.AlternatingItem)
> > > > {
> > > > HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> > > > link.NavigateUrl += "&text=" + link.Text;
> > > > }
> > > >
> > > > Then in page2, you can retrieve it from querystring.
> > > >
> > > > 2. Change Hyperlink column to LinkButton. Then you can process in
> > > > datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> > > > redirect to page2.
> > > >
> > > >
> > > > HTH
> > > >
> > > > Elton Wang
> > > >
> > > > "Joe" wrote:
> > > >
> > > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > > use it in the page_load event of page_2.
> > > > >
> > > > > I've thought of using a hidden field and then calling
> > > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > > exposed click event for the hyperlink control. I could design a custom class
> > > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > > this seems a bit much when a simpler solution may exist.
> > > > >
> > > > > Does anyone have any other ideas?
> > > > >
> > > > > TIA,
> > > > > --
> > > > > Joe
> > > > >
> > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Sm9l

|
Posted: 2005-10-26 23:57:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Elton,
Do you know if disabling the page's viewstate diaables the viewstates of the
controls on teh page?
TIA,
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Elton W" wrote:
> Check the datagrid's EnableViewState, if it's false, enable it. Disabled
> EnableViewState causes datagrid not function properly.
>
> HTH
>
> Elton
>
> "Joe" wrote:
>
> > Elton,
> >
> > The ItemCommand is not firing. Here is my code:
> >
> > Private Sub dgForms_ItemCommand(ByVal source As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
> > dgForms.ItemCommand
> >
> > hdnFormNumber.Value = CType(e.Item.Cells(0).Controls(0), LinkButton).Text
> > End Sub
> >
> > I've had this problem before with the SortCommand, but don't quite know how
> > to resolve it. Do you have any ideas why this wouldn't fire?
> >
> > Joe
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Elton W" wrote:
> >
> > > No you can't cast Hyperlink to link button. You should change HyperLinkColumn
> > > to ButtonColumn (ButtonType=LinkButton). Then you can do your logic in
> > > datagrid_ItemCommand event on server-side.
> > >
> > > HTH
> > >
> > > Elton
> > >
> > > "Joe" wrote:
> > >
> > > > Thanks Elton. I can't use the QueryString due to Business Requirements. How
> > > > do I cast the Hyperlink column in the datagrid to a link button?
> > > > --
> > > > Joe
> > > >
> > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > >
> > > >
> > > > "Elton W" wrote:
> > > >
> > > > > Hi Joe,
> > > > >
> > > > > Two solutions:
> > > > > 1. Still use Hyperlink column in the datagrid, but add something in
> > > > > datagrid_itemDatabound event:
> > > > >
> > > > > if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> > > > > ListItemType.AlternatingItem)
> > > > > {
> > > > > HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> > > > > link.NavigateUrl += "&text=" + link.Text;
> > > > > }
> > > > >
> > > > > Then in page2, you can retrieve it from querystring.
> > > > >
> > > > > 2. Change Hyperlink column to LinkButton. Then you can process in
> > > > > datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> > > > > redirect to page2.
> > > > >
> > > > >
> > > > > HTH
> > > > >
> > > > > Elton Wang
> > > > >
> > > > > "Joe" wrote:
> > > > >
> > > > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > > > use it in the page_load event of page_2.
> > > > > >
> > > > > > I've thought of using a hidden field and then calling
> > > > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > > > exposed click event for the hyperlink control. I could design a custom class
> > > > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > > > this seems a bit much when a simpler solution may exist.
> > > > > >
> > > > > > Does anyone have any other ideas?
> > > > > >
> > > > > > TIA,
> > > > > > --
> > > > > > Joe
> > > > > >
> > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Sm9l

|
Posted: 2005-10-27 0:00:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
EnableViewState is on. Any other ideas?
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Elton W" wrote:
> Check the datagrid's EnableViewState, if it's false, enable it. Disabled
> EnableViewState causes datagrid not function properly.
>
> HTH
>
> Elton
>
> "Joe" wrote:
>
> > Elton,
> >
> > The ItemCommand is not firing. Here is my code:
> >
> > Private Sub dgForms_ItemCommand(ByVal source As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
> > dgForms.ItemCommand
> >
> > hdnFormNumber.Value = CType(e.Item.Cells(0).Controls(0), LinkButton).Text
> > End Sub
> >
> > I've had this problem before with the SortCommand, but don't quite know how
> > to resolve it. Do you have any ideas why this wouldn't fire?
> >
> > Joe
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Elton W" wrote:
> >
> > > No you can't cast Hyperlink to link button. You should change HyperLinkColumn
> > > to ButtonColumn (ButtonType=LinkButton). Then you can do your logic in
> > > datagrid_ItemCommand event on server-side.
> > >
> > > HTH
> > >
> > > Elton
> > >
> > > "Joe" wrote:
> > >
> > > > Thanks Elton. I can't use the QueryString due to Business Requirements. How
> > > > do I cast the Hyperlink column in the datagrid to a link button?
> > > > --
> > > > Joe
> > > >
> > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > >
> > > >
> > > > "Elton W" wrote:
> > > >
> > > > > Hi Joe,
> > > > >
> > > > > Two solutions:
> > > > > 1. Still use Hyperlink column in the datagrid, but add something in
> > > > > datagrid_itemDatabound event:
> > > > >
> > > > > if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> > > > > ListItemType.AlternatingItem)
> > > > > {
> > > > > HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> > > > > link.NavigateUrl += "&text=" + link.Text;
> > > > > }
> > > > >
> > > > > Then in page2, you can retrieve it from querystring.
> > > > >
> > > > > 2. Change Hyperlink column to LinkButton. Then you can process in
> > > > > datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> > > > > redirect to page2.
> > > > >
> > > > >
> > > > > HTH
> > > > >
> > > > > Elton Wang
> > > > >
> > > > > "Joe" wrote:
> > > > >
> > > > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > > > use it in the page_load event of page_2.
> > > > > >
> > > > > > I've thought of using a hidden field and then calling
> > > > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > > > exposed click event for the hyperlink control. I could design a custom class
> > > > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > > > this seems a bit much when a simpler solution may exist.
> > > > > >
> > > > > > Does anyone have any other ideas?
> > > > > >
> > > > > > TIA,
> > > > > > --
> > > > > > Joe
> > > > > >
> > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
RWx0b24gVw

|
Posted: 2005-10-27 0:25:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Set breakpoints in your code and trace running step by step to see what
happens. It might help.
"Joe" wrote:
> EnableViewState is on. Any other ideas?
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>
>
> "Elton W" wrote:
>
> > Check the datagrid's EnableViewState, if it's false, enable it. Disabled
> > EnableViewState causes datagrid not function properly.
> >
> > HTH
> >
> > Elton
> >
> > "Joe" wrote:
> >
> > > Elton,
> > >
> > > The ItemCommand is not firing. Here is my code:
> > >
> > > Private Sub dgForms_ItemCommand(ByVal source As Object, ByVal e As
> > > System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
> > > dgForms.ItemCommand
> > >
> > > hdnFormNumber.Value = CType(e.Item.Cells(0).Controls(0), LinkButton).Text
> > > End Sub
> > >
> > > I've had this problem before with the SortCommand, but don't quite know how
> > > to resolve it. Do you have any ideas why this wouldn't fire?
> > >
> > > Joe
> > > --
> > > Joe
> > >
> > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > >
> > >
> > > "Elton W" wrote:
> > >
> > > > No you can't cast Hyperlink to link button. You should change HyperLinkColumn
> > > > to ButtonColumn (ButtonType=LinkButton). Then you can do your logic in
> > > > datagrid_ItemCommand event on server-side.
> > > >
> > > > HTH
> > > >
> > > > Elton
> > > >
> > > > "Joe" wrote:
> > > >
> > > > > Thanks Elton. I can't use the QueryString due to Business Requirements. How
> > > > > do I cast the Hyperlink column in the datagrid to a link button?
> > > > > --
> > > > > Joe
> > > > >
> > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > >
> > > > >
> > > > > "Elton W" wrote:
> > > > >
> > > > > > Hi Joe,
> > > > > >
> > > > > > Two solutions:
> > > > > > 1. Still use Hyperlink column in the datagrid, but add something in
> > > > > > datagrid_itemDatabound event:
> > > > > >
> > > > > > if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> > > > > > ListItemType.AlternatingItem)
> > > > > > {
> > > > > > HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> > > > > > link.NavigateUrl += "&text=" + link.Text;
> > > > > > }
> > > > > >
> > > > > > Then in page2, you can retrieve it from querystring.
> > > > > >
> > > > > > 2. Change Hyperlink column to LinkButton. Then you can process in
> > > > > > datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> > > > > > redirect to page2.
> > > > > >
> > > > > >
> > > > > > HTH
> > > > > >
> > > > > > Elton Wang
> > > > > >
> > > > > > "Joe" wrote:
> > > > > >
> > > > > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > > > > use it in the page_load event of page_2.
> > > > > > >
> > > > > > > I've thought of using a hidden field and then calling
> > > > > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > > > > exposed click event for the hyperlink control. I could design a custom class
> > > > > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > > > > this seems a bit much when a simpler solution may exist.
> > > > > > >
> > > > > > > Does anyone have any other ideas?
> > > > > > >
> > > > > > > TIA,
> > > > > > > --
> > > > > > > Joe
> > > > > > >
> > > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Sm9l

|
Posted: 2005-10-27 0:49:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Hi Elton,
The company that I work for requires that page-level ViewState be turned
off. So, just to try it, I turned page-level Viewstate on and the code
works. I have the impression that if the page-level ViewState is turned off,
the individual control's viewstates will not work, regardless of whether or
not they are turned on. Do you know anything about this?
I will see if I can find another solution. I have thought of using
AddHandler to link Sub declarations to the LinkButton's Click event. This
has worked with some success in the past and might provide a solution now.
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Elton W" wrote:
> Set breakpoints in your code and trace running step by step to see what
> happens. It might help.
>
> "Joe" wrote:
>
> > EnableViewState is on. Any other ideas?
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Elton W" wrote:
> >
> > > Check the datagrid's EnableViewState, if it's false, enable it. Disabled
> > > EnableViewState causes datagrid not function properly.
> > >
> > > HTH
> > >
> > > Elton
> > >
> > > "Joe" wrote:
> > >
> > > > Elton,
> > > >
> > > > The ItemCommand is not firing. Here is my code:
> > > >
> > > > Private Sub dgForms_ItemCommand(ByVal source As Object, ByVal e As
> > > > System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
> > > > dgForms.ItemCommand
> > > >
> > > > hdnFormNumber.Value = CType(e.Item.Cells(0).Controls(0), LinkButton).Text
> > > > End Sub
> > > >
> > > > I've had this problem before with the SortCommand, but don't quite know how
> > > > to resolve it. Do you have any ideas why this wouldn't fire?
> > > >
> > > > Joe
> > > > --
> > > > Joe
> > > >
> > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > >
> > > >
> > > > "Elton W" wrote:
> > > >
> > > > > No you can't cast Hyperlink to link button. You should change HyperLinkColumn
> > > > > to ButtonColumn (ButtonType=LinkButton). Then you can do your logic in
> > > > > datagrid_ItemCommand event on server-side.
> > > > >
> > > > > HTH
> > > > >
> > > > > Elton
> > > > >
> > > > > "Joe" wrote:
> > > > >
> > > > > > Thanks Elton. I can't use the QueryString due to Business Requirements. How
> > > > > > do I cast the Hyperlink column in the datagrid to a link button?
> > > > > > --
> > > > > > Joe
> > > > > >
> > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > > >
> > > > > >
> > > > > > "Elton W" wrote:
> > > > > >
> > > > > > > Hi Joe,
> > > > > > >
> > > > > > > Two solutions:
> > > > > > > 1. Still use Hyperlink column in the datagrid, but add something in
> > > > > > > datagrid_itemDatabound event:
> > > > > > >
> > > > > > > if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> > > > > > > ListItemType.AlternatingItem)
> > > > > > > {
> > > > > > > HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> > > > > > > link.NavigateUrl += "&text=" + link.Text;
> > > > > > > }
> > > > > > >
> > > > > > > Then in page2, you can retrieve it from querystring.
> > > > > > >
> > > > > > > 2. Change Hyperlink column to LinkButton. Then you can process in
> > > > > > > datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> > > > > > > redirect to page2.
> > > > > > >
> > > > > > >
> > > > > > > HTH
> > > > > > >
> > > > > > > Elton Wang
> > > > > > >
> > > > > > > "Joe" wrote:
> > > > > > >
> > > > > > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > > > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > > > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > > > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > > > > > use it in the page_load event of page_2.
> > > > > > > >
> > > > > > > > I've thought of using a hidden field and then calling
> > > > > > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > > > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > > > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > > > > > exposed click event for the hyperlink control. I could design a custom class
> > > > > > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > > > > > this seems a bit much when a simpler solution may exist.
> > > > > > > >
> > > > > > > > Does anyone have any other ideas?
> > > > > > > >
> > > > > > > > TIA,
> > > > > > > > --
> > > > > > > > Joe
> > > > > > > >
> > > > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
RWx0b24gVw

|
Posted: 2005-10-27 1:51:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
You can try another way. When postback, in Page_Load event, re-bind the
datagrid鈥檚 data source. The disadvantage is that if you need collect user
changed data from the datagrid, the re-binding will overwriting user changed
data.
HTH
Elton
"Joe" wrote:
> Hi Elton,
>
> The company that I work for requires that page-level ViewState be turned
> off. So, just to try it, I turned page-level Viewstate on and the code
> works. I have the impression that if the page-level ViewState is turned off,
> the individual control's viewstates will not work, regardless of whether or
> not they are turned on. Do you know anything about this?
>
> I will see if I can find another solution. I have thought of using
> AddHandler to link Sub declarations to the LinkButton's Click event. This
> has worked with some success in the past and might provide a solution now.
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>
>
> "Elton W" wrote:
>
> > Set breakpoints in your code and trace running step by step to see what
> > happens. It might help.
> >
> > "Joe" wrote:
> >
> > > EnableViewState is on. Any other ideas?
> > > --
> > > Joe
> > >
> > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > >
> > >
> > > "Elton W" wrote:
> > >
> > > > Check the datagrid's EnableViewState, if it's false, enable it. Disabled
> > > > EnableViewState causes datagrid not function properly.
> > > >
> > > > HTH
> > > >
> > > > Elton
> > > >
> > > > "Joe" wrote:
> > > >
> > > > > Elton,
> > > > >
> > > > > The ItemCommand is not firing. Here is my code:
> > > > >
> > > > > Private Sub dgForms_ItemCommand(ByVal source As Object, ByVal e As
> > > > > System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
> > > > > dgForms.ItemCommand
> > > > >
> > > > > hdnFormNumber.Value = CType(e.Item.Cells(0).Controls(0), LinkButton).Text
> > > > > End Sub
> > > > >
> > > > > I've had this problem before with the SortCommand, but don't quite know how
> > > > > to resolve it. Do you have any ideas why this wouldn't fire?
> > > > >
> > > > > Joe
> > > > > --
> > > > > Joe
> > > > >
> > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > >
> > > > >
> > > > > "Elton W" wrote:
> > > > >
> > > > > > No you can't cast Hyperlink to link button. You should change HyperLinkColumn
> > > > > > to ButtonColumn (ButtonType=LinkButton). Then you can do your logic in
> > > > > > datagrid_ItemCommand event on server-side.
> > > > > >
> > > > > > HTH
> > > > > >
> > > > > > Elton
> > > > > >
> > > > > > "Joe" wrote:
> > > > > >
> > > > > > > Thanks Elton. I can't use the QueryString due to Business Requirements. How
> > > > > > > do I cast the Hyperlink column in the datagrid to a link button?
> > > > > > > --
> > > > > > > Joe
> > > > > > >
> > > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > > > >
> > > > > > >
> > > > > > > "Elton W" wrote:
> > > > > > >
> > > > > > > > Hi Joe,
> > > > > > > >
> > > > > > > > Two solutions:
> > > > > > > > 1. Still use Hyperlink column in the datagrid, but add something in
> > > > > > > > datagrid_itemDatabound event:
> > > > > > > >
> > > > > > > > if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> > > > > > > > ListItemType.AlternatingItem)
> > > > > > > > {
> > > > > > > > HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> > > > > > > > link.NavigateUrl += "&text=" + link.Text;
> > > > > > > > }
> > > > > > > >
> > > > > > > > Then in page2, you can retrieve it from querystring.
> > > > > > > >
> > > > > > > > 2. Change Hyperlink column to LinkButton. Then you can process in
> > > > > > > > datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> > > > > > > > redirect to page2.
> > > > > > > >
> > > > > > > >
> > > > > > > > HTH
> > > > > > > >
> > > > > > > > Elton Wang
> > > > > > > >
> > > > > > > > "Joe" wrote:
> > > > > > > >
> > > > > > > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > > > > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > > > > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > > > > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > > > > > > use it in the page_load event of page_2.
> > > > > > > > >
> > > > > > > > > I've thought of using a hidden field and then calling
> > > > > > > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > > > > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > > > > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > > > > > > exposed click event for the hyperlink control. I could design a custom class
> > > > > > > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > > > > > > this seems a bit much when a simpler solution may exist.
> > > > > > > > >
> > > > > > > > > Does anyone have any other ideas?
> > > > > > > > >
> > > > > > > > > TIA,
> > > > > > > > > --
> > > > > > > > > Joe
> > > > > > > > >
> > > > > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
Sm9l

|
Posted: 2005-10-27 2:13:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Elton,
The user can't change any data in the datagrid. We use it solely for
display purposes.
I'm going to post this in today's posts (I am switching back and forth
between too many windows and need to consolidate.). Please feel free to
continue our discussion. I appreciate your suggestions.
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Elton W" wrote:
> You can try another way. When postback, in Page_Load event, re-bind the
> datagrid鈥檚 data source. The disadvantage is that if you need collect user
> changed data from the datagrid, the re-binding will overwriting user changed
> data.
>
> HTH
>
> Elton
>
>
> "Joe" wrote:
>
> > Hi Elton,
> >
> > The company that I work for requires that page-level ViewState be turned
> > off. So, just to try it, I turned page-level Viewstate on and the code
> > works. I have the impression that if the page-level ViewState is turned off,
> > the individual control's viewstates will not work, regardless of whether or
> > not they are turned on. Do you know anything about this?
> >
> > I will see if I can find another solution. I have thought of using
> > AddHandler to link Sub declarations to the LinkButton's Click event. This
> > has worked with some success in the past and might provide a solution now.
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Elton W" wrote:
> >
> > > Set breakpoints in your code and trace running step by step to see what
> > > happens. It might help.
> > >
> > > "Joe" wrote:
> > >
> > > > EnableViewState is on. Any other ideas?
> > > > --
> > > > Joe
> > > >
> > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > >
> > > >
> > > > "Elton W" wrote:
> > > >
> > > > > Check the datagrid's EnableViewState, if it's false, enable it. Disabled
> > > > > EnableViewState causes datagrid not function properly.
> > > > >
> > > > > HTH
> > > > >
> > > > > Elton
> > > > >
> > > > > "Joe" wrote:
> > > > >
> > > > > > Elton,
> > > > > >
> > > > > > The ItemCommand is not firing. Here is my code:
> > > > > >
> > > > > > Private Sub dgForms_ItemCommand(ByVal source As Object, ByVal e As
> > > > > > System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
> > > > > > dgForms.ItemCommand
> > > > > >
> > > > > > hdnFormNumber.Value = CType(e.Item.Cells(0).Controls(0), LinkButton).Text
> > > > > > End Sub
> > > > > >
> > > > > > I've had this problem before with the SortCommand, but don't quite know how
> > > > > > to resolve it. Do you have any ideas why this wouldn't fire?
> > > > > >
> > > > > > Joe
> > > > > > --
> > > > > > Joe
> > > > > >
> > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > > >
> > > > > >
> > > > > > "Elton W" wrote:
> > > > > >
> > > > > > > No you can't cast Hyperlink to link button. You should change HyperLinkColumn
> > > > > > > to ButtonColumn (ButtonType=LinkButton). Then you can do your logic in
> > > > > > > datagrid_ItemCommand event on server-side.
> > > > > > >
> > > > > > > HTH
> > > > > > >
> > > > > > > Elton
> > > > > > >
> > > > > > > "Joe" wrote:
> > > > > > >
> > > > > > > > Thanks Elton. I can't use the QueryString due to Business Requirements. How
> > > > > > > > do I cast the Hyperlink column in the datagrid to a link button?
> > > > > > > > --
> > > > > > > > Joe
> > > > > > > >
> > > > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > > > > >
> > > > > > > >
> > > > > > > > "Elton W" wrote:
> > > > > > > >
> > > > > > > > > Hi Joe,
> > > > > > > > >
> > > > > > > > > Two solutions:
> > > > > > > > > 1. Still use Hyperlink column in the datagrid, but add something in
> > > > > > > > > datagrid_itemDatabound event:
> > > > > > > > >
> > > > > > > > > if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> > > > > > > > > ListItemType.AlternatingItem)
> > > > > > > > > {
> > > > > > > > > HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> > > > > > > > > link.NavigateUrl += "&text=" + link.Text;
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > Then in page2, you can retrieve it from querystring.
> > > > > > > > >
> > > > > > > > > 2. Change Hyperlink column to LinkButton. Then you can process in
> > > > > > > > > datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> > > > > > > > > redirect to page2.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > HTH
> > > > > > > > >
> > > > > > > > > Elton Wang
> > > > > > > > >
> > > > > > > > > "Joe" wrote:
> > > > > > > > >
> > > > > > > > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > > > > > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > > > > > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > > > > > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > > > > > > > use it in the page_load event of page_2.
> > > > > > > > > >
> > > > > > > > > > I've thought of using a hidden field and then calling
> > > > > > > > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > > > > > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > > > > > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > > > > > > > exposed click event for the hyperlink control. I could design a custom class
> > > > > > > > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > > > > > > > this seems a bit much when a simpler solution may exist.
> > > > > > > > > >
> > > > > > > > > > Does anyone have any other ideas?
> > > > > > > > > >
> > > > > > > > > > TIA,
> > > > > > > > > > --
> > > > > > > > > > Joe
> > > > > > > > > >
> > > > > > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
RWx0b24gVw

|
Posted: 2005-10-27 3:51:00 |
Top |
dotnet-framework-aspnet >> Capture hyperlink text property
Actually, I think once you re-bind datagrid鈥檚 data source in postback,
datagrid鈥檚 events will work event disabled datagrid viewstate. Anyhow, you
can try.
HTH
Elton
"Joe" wrote:
> Elton,
>
> The user can't change any data in the datagrid. We use it solely for
> display purposes.
>
> I'm going to post this in today's posts (I am switching back and forth
> between too many windows and need to consolidate.). Please feel free to
> continue our discussion. I appreciate your suggestions.
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>
>
> "Elton W" wrote:
>
> > You can try another way. When postback, in Page_Load event, re-bind the
> > datagrid鈥檚 data source. The disadvantage is that if you need collect user
> > changed data from the datagrid, the re-binding will overwriting user changed
> > data.
> >
> > HTH
> >
> > Elton
> >
> >
> > "Joe" wrote:
> >
> > > Hi Elton,
> > >
> > > The company that I work for requires that page-level ViewState be turned
> > > off. So, just to try it, I turned page-level Viewstate on and the code
> > > works. I have the impression that if the page-level ViewState is turned off,
> > > the individual control's viewstates will not work, regardless of whether or
> > > not they are turned on. Do you know anything about this?
> > >
> > > I will see if I can find another solution. I have thought of using
> > > AddHandler to link Sub declarations to the LinkButton's Click event. This
> > > has worked with some success in the past and might provide a solution now.
> > > --
> > > Joe
> > >
> > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > >
> > >
> > > "Elton W" wrote:
> > >
> > > > Set breakpoints in your code and trace running step by step to see what
> > > > happens. It might help.
> > > >
> > > > "Joe" wrote:
> > > >
> > > > > EnableViewState is on. Any other ideas?
> > > > > --
> > > > > Joe
> > > > >
> > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > >
> > > > >
> > > > > "Elton W" wrote:
> > > > >
> > > > > > Check the datagrid's EnableViewState, if it's false, enable it. Disabled
> > > > > > EnableViewState causes datagrid not function properly.
> > > > > >
> > > > > > HTH
> > > > > >
> > > > > > Elton
> > > > > >
> > > > > > "Joe" wrote:
> > > > > >
> > > > > > > Elton,
> > > > > > >
> > > > > > > The ItemCommand is not firing. Here is my code:
> > > > > > >
> > > > > > > Private Sub dgForms_ItemCommand(ByVal source As Object, ByVal e As
> > > > > > > System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
> > > > > > > dgForms.ItemCommand
> > > > > > >
> > > > > > > hdnFormNumber.Value = CType(e.Item.Cells(0).Controls(0), LinkButton).Text
> > > > > > > End Sub
> > > > > > >
> > > > > > > I've had this problem before with the SortCommand, but don't quite know how
> > > > > > > to resolve it. Do you have any ideas why this wouldn't fire?
> > > > > > >
> > > > > > > Joe
> > > > > > > --
> > > > > > > Joe
> > > > > > >
> > > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > > > >
> > > > > > >
> > > > > > > "Elton W" wrote:
> > > > > > >
> > > > > > > > No you can't cast Hyperlink to link button. You should change HyperLinkColumn
> > > > > > > > to ButtonColumn (ButtonType=LinkButton). Then you can do your logic in
> > > > > > > > datagrid_ItemCommand event on server-side.
> > > > > > > >
> > > > > > > > HTH
> > > > > > > >
> > > > > > > > Elton
> > > > > > > >
> > > > > > > > "Joe" wrote:
> > > > > > > >
> > > > > > > > > Thanks Elton. I can't use the QueryString due to Business Requirements. How
> > > > > > > > > do I cast the Hyperlink column in the datagrid to a link button?
> > > > > > > > > --
> > > > > > > > > Joe
> > > > > > > > >
> > > > > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "Elton W" wrote:
> > > > > > > > >
> > > > > > > > > > Hi Joe,
> > > > > > > > > >
> > > > > > > > > > Two solutions:
> > > > > > > > > > 1. Still use Hyperlink column in the datagrid, but add something in
> > > > > > > > > > datagrid_itemDatabound event:
> > > > > > > > > >
> > > > > > > > > > if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
> > > > > > > > > > ListItemType.AlternatingItem)
> > > > > > > > > > {
> > > > > > > > > > HyperLink link = (HyperLink)e.Item.Cells[link_column_index].Controls[0];
> > > > > > > > > > link.NavigateUrl += "&text=" + link.Text;
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > > Then in page2, you can retrieve it from querystring.
> > > > > > > > > >
> > > > > > > > > > 2. Change Hyperlink column to LinkButton. Then you can process in
> > > > > > > > > > datagrid_ItemCommand event: pass data to Session, Cookie, or queryString and
> > > > > > > > > > redirect to page2.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > HTH
> > > > > > > > > >
> > > > > > > > > > Elton Wang
> > > > > > > > > >
> > > > > > > > > > "Joe" wrote:
> > > > > > > > > >
> > > > > > > > > > > I have an aspx page (referred to here as page_1) with a datagrid whose first
> > > > > > > > > > > column contains hyperlinks. When a user clicks one of these hyperlinks, he
> > > > > > > > > > > will navigate to another aspx page (referred to here as page_2). I need to
> > > > > > > > > > > cache the value of the link's text (hyperlink.text property) so that I can
> > > > > > > > > > > use it in the page_load event of page_2.
> > > > > > > > > > >
> > > > > > > > > > > I've thought of using a hidden field and then calling
> > > > > > > > > > > Request.Form("hdnClickedLinkText") in the Page_Load event of page_2. What I
> > > > > > > > > > > don't know is how to populate the hdnClickedLinkText field on page_1 when the
> > > > > > > > > > > hyperlink is clicked. I've thought about using AddHandler but there is no
> > > > > > > > > > > exposed click event for the hyperlink control. I could design a custom class
> > > > > > > > > > > which inherits from the hyperlink class and implement my own Click event, but
> > > > > > > > > > > this seems a bit much when a simpler solution may exist.
> > > > > > > > > > >
> > > > > > > > > > > Does anyone have any other ideas?
> > > > > > > > > > >
> > > > > > > > > > > TIA,
> > > > > > > > > > > --
> > > > > > > > > > > Joe
> > > > > > > > > > >
> > > > > > > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
|
| |
|
| |
 |
| |
 |
Index ‹ dotnet-framework-aspnet |
- Next
- 1
- Forms Auth SignOut QuestionI have a Forms Auth and use a button that allows users to SignOut below
but when they sign out and PRESS THE BACK BUTTON they can see the
previous page WHY?
Sub SignOut(objSender As Object, objArgs As EventArgs)
'delete the users auth cookie and sign out
System.Web.Security.FormsAuthentication.SignOut()
Session.Abandon()
Session.Remove("Context.User.Identity.Name")
'redirect the user to their referring page
Response.Redirect("logon.aspx?ReturnUrl=%2fFormsAuthAd%2fdefault.aspx")
End Sub
ANY IDEAS WHAT I'M DOING WRONG!
Thx
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- 2
- problem on downlaod zip file via asp net applicationwhen i try to download my zip file via my asp net program, the zip file will
be corrupted after i download, below is my code:
' Identify the file to download including its path.
Dim filepath As String = Server.MapPath("\eClinicApp\VISITD.ZIP")
' Identify the file name.
Dim filename As String = System.IO.Path.GetFileName(filepath)
Response.Clear()
' Specify the Type of the downloadable file.
' octet-stream
Response.ContentType = "application/octet-stream"
' Set the Default file name in the FileDownload dialog box.
Response.AddHeader("Content-Disposition", "attachment; filename="""
& filename & """")
' Download the file.
Response.WriteFile(filepath)
Response.Flush()
Any body know what happen, pls help
- 3
- lost session values, not SessionYour post went unanswered. Have you resolved this issue?
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Xis" <email***@***.com> wrote in message
news:%23XOLlH6%email***@***.com...
> I have several aspx files, where session do as expected with all pages
> except one of them.
> I'm using Trace in the page (winform1.aspx) that session values are lost.
> Only values are lost not session ID !!
> Attached is the trace for the first time I access the page
(Windform1.aspx)
> and also the trace for the second time, when I do something else in the
page
> and session values are lost.
> In line 303 of trace_1.txt you could see the session state:
> entradaNick System.String felix
> ASP.NET_SessionId vsic1n45xiihuf55cmy3mk45
>
> In The second trace values of session dessappear, but no the session ID,
it
> remain the same.
>
>
>
>
- 4
- not properly authenticating?hey all,
i have a simple asp.net app that using window authentication integration and
disallowing anonymous users.
well, when a user tries to browse to this page she gets a "The page cannot
be displayed error." I figured I'd at least get the asp.net error page.
any ideas?
some environment notes:
windows 2000 server sp4
windows 2003 r2 sql server 2005 sp4
xp pro sp2 vs2005 sp1 is my dev
xp pro sp2 is the user's machine with nothing but ie on it.
i'm thinking it's the user is not properly authenticating to active
directory because when i changed iis settings for the app to allow anonymous
the user can get to the page that way. but i'm not user how to troubleshoot
this if this is the case.
thanks,
rodchar
- 5
- shopping cart binding to datagridHi,
I'm wondering if there is a way to bind to datagrid or a gridview the
items in an arraylist. These items all have vars such as price,
qty..etc? (besides putting in a datagrid or datatable first).
ex.
ArrayList alShoppingCart = shoppingCart.GetCurrentItems;
alShoppingCart contains an array list of Item objects.
Thanks
Maz.
- 6
- Oracle Data Provider for .NETHello to everybody,
I hope this group is the correct one for posting my problem. If I've
posted in the wrong place, could you please redirect me to the correct
group? Thank you in advance for that ;)
My problem:
I need to call an oracle function from a .NET application passing an
XmlType input parameter to it. I have no idea on how to set the value
of this input parameter. I've tried to pass a String, but it results
in a NULL XmlType parameter value (using Toad as a SQL Profiler).
Any help is welcome,
bye,
Simone.
- 7
- 8
- ASP.NET 2.0 hosting with ATLAS for personal homepagegood luck! If you find somewhere that does this could you let me know
im looking for the same thing but havent found anywhere that will do
this for less than 70
email***@***.com wrote:
> Hi,
>
> I'm looking for an ASP.NET 2.0 hosting with ATLAS to put my personal
> homepage. I don't want to spend more than 25€ / year (=32 USD). And
> of couse, I don't want add banners or popups.
>
> Anyone knows or has experience with a good one?
>
> Veerle
- 9
- 10
- TIP: httpRuntime executionTimeoutI had noticed a number of people posting that they where having
trouble getting the Web.config httpRuntime executionTimeout attribute
to work as expected.
I realized today that if the compilation debug attribute is set to
"true" in the configuration, then the framework doesn't seem to
timeout requests (probably because this might be annoying if you had a
debugger attached and were stepping through code).
It would be nice if the MSDN documentation for the executionTimeout
config attribute referenced this dependency. A similar thing that
threw me for awhile was that a trace="true" at the page level seems to
implicitly cause a No-Cache directive to be issued in the response.
Hope this helps someone.
Pete
- 11
- Multi-threaded HTTP ModuleAll,
I am trying to write a multi-threaded HTTP module that handles the
OnBeginRequest and logs it. What I am trying to do is to offload the
logging to another thread which will allow the http module to release
the OnBeginRequest.
The issue that I have is that I keep on getting "Request is not
available in this context" exceptions.
The following is the code I am using:
using System;
using System.Web;
public class ProcessRequest
{
public HttpApplication HttpRequest;
public void ProcessingThread()
{
try
{
string sRequestUrl;
if (HttpRequest.Request!=null)
{
sRequestUrl=HttpRequest.Request.HttpMethod;
System.Diagnostics.Debug.WriteLine(sRequestUrl);
}
}
catch (System.Exception ex)
{
throw ex;
}
}
}
public class HttpRequestLogger : IHttpModule
{
protected System.Collections.Queue oHttpRequestQueue= new
System.Collections.Queue();
protected bool bModuleRunning =false;
public HttpRequestLogger()
{
}
// In the Init function, register for HttpApplication
// events by adding your handlers.
public void Init(HttpApplication application)
{
application.BeginRequest +=
(new EventHandler(this.Application_BeginRequest));
application.EndRequest +=
(new EventHandler(this.Application_EndRequest));
}
private void Application_BeginRequest(Object source, EventArgs e)
{
// Create HttpApplication and HttpContext objects to access
// request and response properties.
System.Threading.Thread oProcessingThread;
HttpApplication application = (HttpApplication)source;
ProcessRequest oRequestProcessor=new ProcessRequest();
oRequestProcessor.HttpRequest=application;
oProcessingThread =new System.Threading.Thread(new
System.Threading.ThreadStart(oRequestProcessor.ProcessingThread));
oProcessingThread.Start();
}
private void Application_EndRequest(Object source, EventArgs e)
{
// HttpApplication application = (HttpApplication)source;
// HttpContext context = application.Context;
}
public void Dispose()
{
}
}
- 12
- problem with multithreading and Web services method invocationHi:
I have an ASP.NET page which makes a synchronous Web services method
call. At the same time, however, I wanted it to load another page as an
iFrame (i've also tried as a javascript popup window) - this second
page is responsible for polling a DB and continually updating its text
box display.
The problem is that once the Web service call is initiated, the second
page becomes unresponsive exactly until the call is completed, when it
resumes. I'm baffled as to why this second page's request should have
anything to do with the first one's Web service request. I've tried to
encapsulate the time-consuming DB queries of the second page into a
separate thread and this works great (I tested it by printing a
timestamp to a file), but I also need a way of updating the display in
real-time while the Web services call is going through. Are there any
ideas as to how I can accomplish this?
- adh
- 13
- 14
- Getting control of Items within a DatalistI have a problem as I have placed a dropdownlist in a datalist.
Whenever the selected index changes I need to change a label inside
the datalist.
The problem is I can't get control of the label.
When dropdownlist changes it goes to a function with args of
systemEvent than a DataListItemEventArgs so I have no way getting
control of the item in the datalist to change the label.
Can someone please help me.
- 15
- Invoke IE from ASP.NETHi
I would like to invoke a new instance of IE from within a page and pass it a
URL. How can I do this in C#?
I have tried using SHDOCVW.DLL to no avail.
TIA
|
|
|