473,395 Members | 1,541 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.

Using HyperlinkColumn!

Hi all,
I have this big problem with hyperlinks I would appriciate any help
please.
My web site has two datagrids on the same page. And one has a list of
names of the users which are in a HyperlinkColumn. The second datagrid
is for inserting data, and when a user inserts data I used 'Windows
Authentication' for names in one column called Name.
Now this is how it's supposed to work: When any user want to see data
about a particular user it's a matter of selecting his name and the
data Writen by the selected user should be the only ones to be shown.
I got some examples on Google but they all seem not to be working.
When a user is selected the URL changes instead of the particular rows
in the datagrid to be selected. For example the original url is
"http://localhost/Dash_Board/DashBoard.aspx" and if I select user
Claude the URL change into "http://localhost/Dash_Board/Claude" and
get an error The page cannot be found. Why would this be happening?
My code looks like this:
HTML part:
<Columns>
<asp:HyperLinkColumn Target="_self" DataNavigateUrlField="TeamBilling"
DataTextField="TeamBilling" HeaderText="Billing"
DataTextFormatString="{0:c}"></asp:HyperLinkColumn>
</Columns>
and code behind:
private void dgbilling_SelectedIndexChanged(object sender,
System.EventArgs e)
{
SqlCommand myCommand = new SqlCommand("select * from dbo.DashBoard
where Name = @Billing",con);
SqlParameter myparam = new SqlParameter("@Billing",SqlDbType.Text);
myparam.Value="../Dash_Board/DashBoard.aspx?,Name{0}";
myCommand.Parameters.Add(myparam);
SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds);
dgis.DataSource=ds;
dgis.EditItemIndex = -1;
dgis.DataBind();
}
dgis: this is the datagrid that where user inserts data.
dgbilling: this is the hyperlinkcolumn.
Thanks.

May 11 '07 #1
4 2241
On May 11, 7:34 am, rcoco <nclau...@yahoo.cawrote:
Hi all,
I have this big problem with hyperlinks I would appriciate any help
please.
My web site has two datagrids on the same page. And one has a list of
names of the users which are in a HyperlinkColumn. The second datagrid
is for inserting data, and when a user inserts data I used 'Windows
Authentication' for names in one column called Name.
Now this is how it's supposed to work: When any user want to see data
about a particular user it's a matter of selecting his name and the
data Writen by the selected user should be the only ones to be shown.
I got some examples on Google but they all seem not to be working.
When a user is selected the URL changes instead of the particular rows
in the datagrid to be selected. For example the original url is
"http://localhost/Dash_Board/DashBoard.aspx" and if I select user
Claude the URL change into "http://localhost/Dash_Board/Claude" and
get an error The page cannot be found. Why would this be happening?
My code looks like this:
HTML part:
<Columns>
<asp:HyperLinkColumn Target="_self" DataNavigateUrlField="TeamBilling"
DataTextField="TeamBilling" HeaderText="Billing"
DataTextFormatString="{0:c}"></asp:HyperLinkColumn>
</Columns>
and code behind:
private void dgbilling_SelectedIndexChanged(object sender,
System.EventArgs e)
{
SqlCommand myCommand = new SqlCommand("select * from dbo.DashBoard
where Name = @Billing",con);
SqlParameter myparam = new SqlParameter("@Billing",SqlDbType.Text);
myparam.Value="../Dash_Board/DashBoard.aspx?,Name{0}";
myCommand.Parameters.Add(myparam);
SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds);
dgis.DataSource=ds;
dgis.EditItemIndex = -1;
dgis.DataBind();}

dgis: this is the datagrid that where user inserts data.
dgbilling: this is the hyperlinkcolumn.
Thanks.
You forgot about link - DataNavigateUrlFormatString

<asp:HyperLinkColumn Target="_self"
DataNavigateUrlField="TeamBilling"
DataTextField="TeamBilling" HeaderText="Billing"

DataNavigateUrlFormatString="DashBoard.aspx?Name={ 0}"

DataTextFormatString="{0:c}"></asp:HyperLinkColumn>

and change

myparam.Value="../Dash_Board/DashBoard.aspx?,Name{0}";

to

myparam.Value="../Dash_Board/DashBoard.aspx?Name={0}";

I hope, it will work...

Note, the DataGrid Control (are you ASP.Net 1.0)? has Edit mode, where
the data for the record can be entered and saved without having a
second grid.

Take a look at "VB DataGrid6.aspx"
http://samples.gotdotnet.com/quickst..._datagrid.aspx

May 11 '07 #2
Thanks Alexey,
Yes there is a difference I don't get the error any more but neighther
do I get the result I want for data to be selected. I still can't get
why when I select data in hyperlink column the data to be selected in
data grid is not selected but the page reacts as if it is being
refreshed.
Thanks

On May 11, 10:10 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On May 11, 7:34 am, rcoco <nclau...@yahoo.cawrote:


Hi all,
I have this big problem with hyperlinks I would appriciate any help
please.
My web site has two datagrids on the same page. And one has a list of
names of the users which are in a HyperlinkColumn. The second datagrid
is for inserting data, and when a user inserts data I used 'Windows
Authentication' for names in one column called Name.
Now this is how it's supposed to work: When any user want to see data
about a particular user it's a matter of selecting his name and the
data Writen by the selected user should be the only ones to be shown.
I got some examples on Google but they all seem not to be working.
When a user is selected the URL changes instead of the particular rows
in the datagrid to be selected. For example the original url is
"http://localhost/Dash_Board/DashBoard.aspx" and if I select user
Claude the URL change into "http://localhost/Dash_Board/Claude" and
get an error The page cannot be found. Why would this be happening?
My code looks like this:
HTML part:
<Columns>
<asp:HyperLinkColumn Target="_self" DataNavigateUrlField="TeamBilling"
DataTextField="TeamBilling" HeaderText="Billing"
DataTextFormatString="{0:c}"></asp:HyperLinkColumn>
</Columns>
and code behind:
private void dgbilling_SelectedIndexChanged(object sender,
System.EventArgs e)
{
SqlCommand myCommand = new SqlCommand("select * from dbo.DashBoard
where Name = @Billing",con);
SqlParameter myparam = new SqlParameter("@Billing",SqlDbType.Text);
myparam.Value="../Dash_Board/DashBoard.aspx?,Name{0}";
myCommand.Parameters.Add(myparam);
SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds);
dgis.DataSource=ds;
dgis.EditItemIndex = -1;
dgis.DataBind();}
dgis: this is the datagrid that where user inserts data.
dgbilling: this is the hyperlinkcolumn.
Thanks.

You forgot about link - DataNavigateUrlFormatString

<asp:HyperLinkColumn Target="_self"
DataNavigateUrlField="TeamBilling"
DataTextField="TeamBilling" HeaderText="Billing"

DataNavigateUrlFormatString="DashBoard.aspx?Name={ 0}"

DataTextFormatString="{0:c}"></asp:HyperLinkColumn>

and change

myparam.Value="../Dash_Board/DashBoard.aspx?,Name{0}";

to

myparam.Value="../Dash_Board/DashBoard.aspx?Name={0}";

I hope, it will work...

Note, the DataGrid Control (are you ASP.Net 1.0)? has Edit mode, where
the data for the record can be entered and saved without having a
second grid.

Take a look at "VB DataGrid6.aspx"http://samples.gotdotnet.com/quickstart/aspplus/samples/webforms/ctrl...- Hide quoted text -

- Show quoted text -

May 14 '07 #3
On May 14, 2:08 pm, rcoco <nclau...@yahoo.cawrote:
Thanks Alexey,
Yes there is a difference I don't get the error any more but neighther
do I get the result I want for data to be selected. I still can't get
why when I select data in hyperlink column the data to be selected in
data grid is not selected but the page reacts as if it is being
refreshed.
Thanks

On May 11, 10:10 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On May 11, 7:34 am, rcoco <nclau...@yahoo.cawrote:
Hi all,
I have this big problem with hyperlinks I would appriciate any help
please.
My web site has two datagrids on the same page. And one has a list of
names of the users which are in a HyperlinkColumn. The second datagrid
is for inserting data, and when a user inserts data I used 'Windows
Authentication' for names in one column called Name.
Now this is how it's supposed to work: When any user want to see data
about a particular user it's a matter of selecting his name and the
data Writen by the selected user should be the only ones to be shown.
I got some examples on Google but they all seem not to be working.
When a user is selected the URL changes instead of the particular rows
in the datagrid to be selected. For example the original url is
"http://localhost/Dash_Board/DashBoard.aspx" and if I select user
Claude the URL change into "http://localhost/Dash_Board/Claude" and
get an error The page cannot be found. Why would this be happening?
My code looks like this:
HTML part:
<Columns>
<asp:HyperLinkColumn Target="_self" DataNavigateUrlField="TeamBilling"
DataTextField="TeamBilling" HeaderText="Billing"
DataTextFormatString="{0:c}"></asp:HyperLinkColumn>
</Columns>
and code behind:
private void dgbilling_SelectedIndexChanged(object sender,
System.EventArgs e)
{
SqlCommand myCommand = new SqlCommand("select * from dbo.DashBoard
where Name = @Billing",con);
SqlParameter myparam = new SqlParameter("@Billing",SqlDbType.Text);
myparam.Value="../Dash_Board/DashBoard.aspx?,Name{0}";
myCommand.Parameters.Add(myparam);
SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds);
dgis.DataSource=ds;
dgis.EditItemIndex = -1;
dgis.DataBind();}
dgis: this is the datagrid that where user inserts data.
dgbilling: this is the hyperlinkcolumn.
Thanks.
You forgot about link - DataNavigateUrlFormatString
<asp:HyperLinkColumn Target="_self"
DataNavigateUrlField="TeamBilling"
DataTextField="TeamBilling" HeaderText="Billing"
DataNavigateUrlFormatString="DashBoard.aspx?Name={ 0}"
DataTextFormatString="{0:c}"></asp:HyperLinkColumn>
and change
myparam.Value="../Dash_Board/DashBoard.aspx?,Name{0}";
to
myparam.Value="../Dash_Board/DashBoard.aspx?Name={0}";
I hope, it will work...
Note, the DataGrid Control (are you ASP.Net 1.0)? has Edit mode, where
the data for the record can be entered and saved without having a
second grid.
Take a look at "VB DataGrid6.aspx"http://samples.gotdotnet.com/quickstart/aspplus/samples/webforms/ctrl...Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
Please post a code here, I will have a look

May 14 '07 #4
Hi Alexey,
This is the code I'm using:
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="TeamBilling"
DataNavigateUrlFormatString="DashBoard.aspx?Name={ 0}"
DataTextField="TeamBilling" HeaderText="Billing"
DataTextFormatString="{0:c}"></asp:HyperLinkColumn>
</Columns>
Code behind:
private void dgbilling_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
SqlCommand myCommand = new SqlCommand("select * from dbo.DashBoard
where Name Like @Billing",con);
SqlParameter myparam = new SqlParameter("@Billing",SqlDbType.Text);
myparam.Value="DashBoard.aspx?={0}";
myCommand.Parameters.Add(myparam);
SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds);
dgis.DataSource=ds;
dgis.EditItemIndex = -1;
dgis.DataBind();
}
Thanks

May 15 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jongmin | last post by:
Hi! I am making HyperLinkColumn in datagrid. It is simple to make the hyerlinkcolumn with one datafield. <asp:HyperLinkColumn Text="NAME" DataNavigateUrlField="NAME"...
1
by: Dmitri Manushin | last post by:
Hi all, i have HyperLinkColumn in DataGrid <asp:HyperLinkColumn DataNavigateUrlField="PostID" DataNavigateUrlFormatString="http://localhost/forum/posts.aspx?id={0}" DataTextField="Subject"...
3
by: SStory | last post by:
I have a style sheet for my site. It has various classes in it. It has <A: styles defined for all anchor tags. I have a datagrid in ASP.NET with a stylesheet linked to the page. It defines...
3
by: Morten | last post by:
Hi. After a while I finaly discovered how to use HyperLinkColumns. What I can't find is how to send mote than one "value" like page.aspx?id1&id2!!! <asp:HyperLinkColumn...
3
by: TJS | last post by:
how can I encrypt the querystring values for a HyperLinkColumn ? in example below I would like to encrypt value for field1 ======================================================...
1
by: Shawn | last post by:
Hi. I have a DataGrid with a hyperlinkcolumn, like this: <asp:hyperlinkcolumn datanavigateurlfield="prr_id" datanavigateurlformatstring="test.aspx?prr_id={0}"...
3
by: Maziar Aflatoun | last post by:
Hi everyone, Does anyone know how I can apply the css 'linksmall' to my hyperlink in my datagrid? I have the following and it doesn't work <asp:HyperLinkColumn Text="Edit"...
1
by: Craig | last post by:
I have a datagrid with a couple of columns. Right now, I'm setting assigning the dataview to the datasource. For the HyperLinkColumn.... <asp:HyperLinkColumn...
0
by: nclauder | last post by:
Hi all, I have this big problem with hyperlinks I would appriciate any help please. My web site has two datagrids on the same page. And one has a list of names of the users which are in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By 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.