473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to replace value of name for Hyperlink control during runtime

49
Hello,
i want to change name of hyper link during runtime ,i put text box i take value from text box and put it as name of hyper link but when i reload page the original name of hyper link back again what i can i do to save the new value for ever.

Thanks
Orked.
Oct 4 '10 #1
2 3174
Check EnableViewState=true for your Control. Try as follow when press first button and then second button, Hiperlink Text will remain: "Your Link";
(asp.net markup code)
Expand|Select|Wrap|Line Numbers
  1. <asp:HyperLink ID="HyperLink1" Text="My Link"
  2.   runat="server" EnableViewState="true">
  3. </asp:HyperLink>
  4. <asp:Button ID="Button1" runat="server" 
  5.  Text="Button" onclick="Button1_Click"/>
  6. <asp:Button ID="Button2" runat="server" 
  7.  Text="Button" />
(c# server-side code)
Expand|Select|Wrap|Line Numbers
  1. protected void Button1_Click(object sender, EventArgs e)
  2. {
  3.   HyperLink1.Text = "Your Link";
  4. }
Oct 4 '10 #2
orked
49
i know this point but i mean i have 2 hyper link they do not have text for them because i want to give them this value during runtime i will write the value in textbox and i will press button1 to apply this value and i will use hyper link 2 to reload page if i write test word in textbox and press button1 the text for hyper link 1 will be "test" if i press hyper link after that the original value for hyper link1 will back again but i want to save this value for ever and change it when i want
This is my code:
C#
Expand|Select|Wrap|Line Numbers
  1. protected void Button1_Click(object sender, EventArgs e)
  2.     {
  3.         HyperLink1.Text = TextBox1.Text;
  4.     } 
asp.net code
Expand|Select|Wrap|Line Numbers
  1.  <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
  2.         <br />
  3.     <asp:HyperLink ID="HyperLink1" runat="server"  EnableViewState="true" NavigateUrl="~/Default2.aspx">[HyperLink1]</asp:HyperLink>
  4.     <br />
  5.     <asp:HyperLink ID="HyperLink2" runat="server"  EnableViewState="true" NavigateUrl="~/Default4.aspx">[HyperLink2]</asp:HyperLink>
  6.     <br />
  7.     <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
if u have any suggestion please tell me
Thanks
Orked
Oct 4 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: ann | last post by:
I am trying to access the text of the hyperlink control during the delete command. I am retrieving the ID in there as well and it works fine:e.Item.Cells.Text The hyperlink code is returning...
3
by: Newbie | last post by:
hi! i am able to upload files successfully. but i have one minor problem. files are uploaded correctly if the directory exists, it is throwing an exception if the directory doesnt exist. but the...
3
by: Cindy | last post by:
ASP.NET - C# (User Control) I have a drop-down as usercontrol. In the user control's Page_Init , the drop down gets populated. The SelectedItem.Text is retrived using property get The...
3
by: Sampson | last post by:
I have a question about enumeration and how to populate them during runtime. I am using vb.net but will happily take any advice in c# as well. Here is an example to help illustrate what I am...
1
by: Priya | last post by:
Hi, I'm using a repeater control. I'm binding data to repeater dynamically. I need to modify the value of a label at runtime. I modified the text in the ItemDataBound event. But while displaying...
3
by: keithb | last post by:
Using a GridView, I get a "Specified cast is not valid" error when binding the Visible propery of a hyperlink control to a DataTable text field. The error goes away if I replace the data binding...
1
by: Peter Gast | last post by:
Hi, I need as parameter for a control the names of my properties as a string. How can I get the name of the property as a string during runtime Example: Private _MyVar As Double Public...
3
by: Peter Gast | last post by:
Hi, I need as a parameter for a control the names of my properties as a string. How can I get the name of the property as a string during runtime Example: Private _MyVar As Double Public...
3
by: dutsnekcirf | last post by:
I have a treeview control on a custom task pane in Excel. I've enable the ability to use Drag & Drop (by following this how-to) on the treeview to change the order of the nodes. The problem though...
1
by: sivasrec | last post by:
Hi, This is sivakumar from India. Now I am learning to ASP.NET 2.0.. I have a doubt.... I have used in a one hidden field control, 2 label controls, 2 button controls and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.