Connecting Tech Pros Worldwide Forums | Help | Site Map

Using HyperlinkColumn!

rcoco
Guest
 
Posts: n/a
#1: May 11 '07
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.

Alexey Smirnov
Guest
 
Posts: n/a
#2: May 11 '07

re: Using HyperlinkColumn!


On May 11, 7:34 am, rcoco <nclau...@yahoo.cawrote:
Quote:
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

rcoco
Guest
 
Posts: n/a
#3: May 14 '07

re: Using HyperlinkColumn!


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:
Quote:
On May 11, 7:34 am, rcoco <nclau...@yahoo.cawrote:
>
>
>
>
>
Quote:
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();}
>
Quote:
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 -

Alexey Smirnov
Guest
 
Posts: n/a
#4: May 14 '07

re: Using HyperlinkColumn!


On May 14, 2:08 pm, rcoco <nclau...@yahoo.cawrote:
Quote:
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:
>
>
>
Quote:
On May 11, 7:34 am, rcoco <nclau...@yahoo.cawrote:
>
Quote:
Quote:
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();}
>
Quote:
Quote:
dgis: this is the datagrid that where user inserts data.
dgbilling: this is the hyperlinkcolumn.
Thanks.
>
Quote:
You forgot about link - DataNavigateUrlFormatString
>
Quote:
<asp:HyperLinkColumn Target="_self"
DataNavigateUrlField="TeamBilling"
DataTextField="TeamBilling" HeaderText="Billing"
>
Quote:
DataNavigateUrlFormatString="DashBoard.aspx?Name={ 0}"
>
Quote:
DataTextFormatString="{0:c}"></asp:HyperLinkColumn>
>
Quote:
and change
>
Quote:
myparam.Value="../Dash_Board/DashBoard.aspx?,Name{0}";
>
Quote:
to
>
Quote:
myparam.Value="../Dash_Board/DashBoard.aspx?Name={0}";
>
Quote:
I hope, it will work...
>
Quote:
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.
>
Quote:
Take a look at "VB DataGrid6.aspx"http://samples.gotdotnet.com/quickstart/aspplus/samples/webforms/ctrl...Hide quoted text -
>
Quote:
- Show quoted text -- Hide quoted text -
>
- Show quoted text -
Please post a code here, I will have a look

rcoco
Guest
 
Posts: n/a
#5: May 15 '07

re: Using HyperlinkColumn!


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

Closed Thread