GridView
Hi
I'm using a GridView to list data from a table in my database. On of the
fields is a URL and when I click a row in the GridView I want the page to
automaticly open that link. How do I write code to an event i the GridView
so that when I click a row the page opens up the new link in another window?
Lars
RE: GridView
You are going to need a little Javascript
<script type ="text/javascript">
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Mat h.random()*(screen.width-w)):100;TopPosition=(screen.height) ?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width- w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100 ;}
else if((pos!="center" && pos!="random") ||
pos==null){LeftPosition=0;TopPosition }
settings='width='+w+',height='+h+',top='+TopPosition+',left= '+LeftPosition+',scrollbars='+scroll+',location=no,directori es=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
// Put this in your onclick event
function PopUpWnd()
{
var pg = document.getElementById("id")
NewWindow("CurrencyPage.aspx","abc", 350, 360, "No", "center")
}
</script>
You wire it something like this
<input id="btnChgCurrency" runat="server" type="button" value="Change
Currency" onclick="PopUpWnd()" name="btnChgCurrency" />
--
aaa
"rosoft" wrote:
> Hi
>
> I'm using a GridView to list data from a table in my database. On of the
> fields is a URL and when I click a row in the GridView I want the page to
> automaticly open that link. How do I write code to an event i the GridView
> so that when I click a row the page opens up the new link in another window?
>
> Lars
>
>
>
Re: GridView
Hi
> <input id="btnChgCurrency" runat="server" type="button" value="Change
> Currency" onclick="PopUpWnd()" name="btnChgCurrency" />
But I donät want a button I want the table (GridView) to display a html
link. I tried to enter html text into the database table but that only
showed the source code for the html link in the Grid View such as
<p>A Track</p>
When I work with PHP I read data from a table and then create a table.
Couldn't I some how make a C# class that handled this. Read data from a
database into some sort of view and then read the view and create html code
that I then write to the page. Having to do all this in a Java Script? Then
I'm better of with a PHP page. I was told that C# can fix these things
easaly.
Is there any C# classes I can use to create backend modules for my homepage
on the server. Some class where I send for example <asp:Table ID="Table1"
runat="server">......</asp:Table>. And then pass Table1 as a parameter to an
object where the object fills the Table with data?
I just don't want to show the informatin in the database as it is since I
use it to build links depending on who's logged into the page.
Lars
"Angel" <rodoopus [at] hotmail.com> skrev i meddelandet
news:740E2606-0B7A-42EA-A059-C7B788AE36CB [at] microsoft.com...
> You are going to need a little Javascript
>
> <script type ="text/javascript">
> var win=null;
>
> function NewWindow(mypage,myname,w,h,scroll,pos){
>
>
> if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Mat h.random()*(screen.width-w)):100;TopPosition=(screen.height) ?Math.floor(Math.random()*((screen.height-h)-75)):100;}
>
>
> if(pos=="center"){LeftPosition=(screen.width)?(screen.width- w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100 ;}
>
> else if((pos!="center" && pos!="random") ||
> pos==null){LeftPosition=0;TopPosition }
>
>
> settings='width='+w+',height='+h+',top='+TopPosition+',left= '+LeftPosition+',scrollbars='+scroll+',location=no,directori es=no,status=no,menubar=no,toolbar=no,resizable=no';
> win=window.open(mypage,myname,settings);}
> // Put this in your onclick event
>
> function PopUpWnd()
> {
> var pg = document.getElementById("id")
>
> NewWindow("CurrencyPage.aspx","abc", 350, 360, "No", "center")
> }
>
> </script>
>
>
> You wire it something like this
>
> <input id="btnChgCurrency" runat="server" type="button" value="Change
> Currency" onclick="PopUpWnd()" name="btnChgCurrency" />
>
> --
> aaa
>
>
> "rosoft" wrote:
>
>> Hi
>>
>> I'm using a GridView to list data from a table in my database. On of the
>> fields is a URL and when I click a row in the GridView I want the page to
>> automaticly open that link. How do I write code to an event i the
>> GridView
>> so that when I click a row the page opens up the new link in another
>> window?
>>
>> Lars
>>
>>
>>
Re: GridView
On Jan 30, 8:28=A0am, "rosoft" <supp... [at] RosoftEngineering.com> wrote:
> Hi
>
> I'm using a GridView to list data from a table in my database. On of the
> fields is a URL and when I click a row in the GridView I want the page to
> automaticly open that link. How do I write code to an event i the GridView=
> so that when I click a row the page opens up the new link in another windo=
w?
>
> Lars
The GridView control has a HyperLink field, which might be what you
are looking for. Just google GridView HyperLink.
Re: GridView
As an added note, the HyperlinkField has a Target property (relates to the
HTML hyperlink target attribute), so you can easily get it to open in
another window
David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
"gnewsgroup" <gnewsgroup [at] gmail.com> wrote in message
news:b10351b8-5ebc-4729-8888-dc9cc08d6f54 [at] i29g2000prf.google groups.com...
On Jan 30, 8:28 am, "rosoft" <supp... [at] RosoftEngineering.com> wrote:
> Hi
>
> I'm using a GridView to list data from a table in my database. On of the
> fields is a URL and when I click a row in the GridView I want the page to
> automaticly open that link. How do I write code to an event i the GridView
> so that when I click a row the page opens up the new link in another
> window?
>
> Lars
The GridView control has a HyperLink field, which might be what you
are looking for. Just google GridView HyperLink.
Re: GridView
So you're saying the javascript I wrote becomes unnecessary?
--
aaa
"David Wier" wrote:
> As an added note, the HyperlinkField has a Target property (relates to the
> HTML hyperlink target attribute), so you can easily get it to open in
> another window
>
>
> David Wier
> http://aspnet101.com
> http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
> bloated markup
>
>
> "gnewsgroup" <gnewsgroup [at] gmail.com> wrote in message
> news:b10351b8-5ebc-4729-8888-dc9cc08d6f54 [at] i29g2000prf.google groups.com...
> On Jan 30, 8:28 am, "rosoft" <supp... [at] RosoftEngineering.com> wrote:
> > Hi
> >
> > I'm using a GridView to list data from a table in my database. On of the
> > fields is a URL and when I click a row in the GridView I want the page to
> > automaticly open that link. How do I write code to an event i the GridView
> > so that when I click a row the page opens up the new link in another
> > window?
> >
> > Lars
>
> The GridView control has a HyperLink field, which might be what you
> are looking for. Just google GridView HyperLink.
>
>
>
Re: GridView
You can do this
Dim cmd As New CommandField
cmd.EditText = "Select"
cmd.ButtonType = ButtonType.Link
cmd.ShowSelectButton = True
grid.Columns.Add(cmd)
or you can do it declaritive
or you can use the wizard
Lot's of choices
But I never link this command button to pop-up window as David is suggesting
--
aaa
"rosoft" wrote:
> Hi
>
> > <input id="btnChgCurrency" runat="server" type="button" value="Change
> > Currency" onclick="PopUpWnd()" name="btnChgCurrency" />
>
> But I donät want a button I want the table (GridView) to display a html
> link. I tried to enter html text into the database table but that only
> showed the source code for the html link in the Grid View such as
>
> <p>A Track</p>
>
> When I work with PHP I read data from a table and then create a table.
> Couldn't I some how make a C# class that handled this. Read data from a
> database into some sort of view and then read the view and create html code
> that I then write to the page. Having to do all this in a Java Script? Then
> I'm better of with a PHP page. I was told that C# can fix these things
> easaly.
>
> Is there any C# classes I can use to create backend modules for my homepage
> on the server. Some class where I send for example <asp:Table ID="Table1"
> runat="server">......</asp:Table>. And then pass Table1 as a parameter to an
> object where the object fills the Table with data?
>
> I just don't want to show the informatin in the database as it is since I
> use it to build links depending on who's logged into the page.
>
> Lars
>
>
> "Angel" <rodoopus [at] hotmail.com> skrev i meddelandet
> news:740E2606-0B7A-42EA-A059-C7B788AE36CB [at] microsoft.com...
> > You are going to need a little Javascript
> >
> > <script type ="text/javascript">
> > var win=null;
> >
> > function NewWindow(mypage,myname,w,h,scroll,pos){
> >
> >
> > if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Mat h.random()*(screen.width-w)):100;TopPosition=(screen.height) ?Math.floor(Math.random()*((screen.height-h)-75)):100;}
> >
> >
> > if(pos=="center"){LeftPosition=(screen.width)?(screen.width- w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100 ;}
> >
> > else if((pos!="center" && pos!="random") ||
> > pos==null){LeftPosition=0;TopPosition }
> >
> >
> > settings='width='+w+',height='+h+',top='+TopPosition+',left= '+LeftPosition+',scrollbars='+scroll+',location=no,directori es=no,status=no,menubar=no,toolbar=no,resizable=no';
> > win=window.open(mypage,myname,settings);}
> > // Put this in your onclick event
> >
> > function PopUpWnd()
> > {
> > var pg = document.getElementById("id")
> >
> > NewWindow("CurrencyPage.aspx","abc", 350, 360, "No", "center")
> > }
> >
> > </script>
> >
> >
> > You wire it something like this
> >
> > <input id="btnChgCurrency" runat="server" type="button" value="Change
> > Currency" onclick="PopUpWnd()" name="btnChgCurrency" />
> >
> > --
> > aaa
> >
> >
> > "rosoft" wrote:
> >
> >> Hi
> >>
> >> I'm using a GridView to list data from a table in my database. On of the
> >> fields is a URL and when I click a row in the GridView I want the page to
> >> automaticly open that link. How do I write code to an event i the
> >> GridView
> >> so that when I click a row the page opens up the new link in another
> >> window?
> >>
> >> Lars
> >>
> >>
> >>
>
>
>
Re: GridView
David,
I went and did a little checking and could not find the Target property or
its use. Could you point us to an example or a link that talks about this
--
aaa
"David Wier" wrote:
> As an added note, the HyperlinkField has a Target property (relates to the
> HTML hyperlink target attribute), so you can easily get it to open in
> another window
>
>
> David Wier
> http://aspnet101.com
> http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
> bloated markup
>
>
> "gnewsgroup" <gnewsgroup [at] gmail.com> wrote in message
> news:b10351b8-5ebc-4729-8888-dc9cc08d6f54 [at] i29g2000prf.google groups.com...
> On Jan 30, 8:28 am, "rosoft" <supp... [at] RosoftEngineering.com> wrote:
> > Hi
> >
> > I'm using a GridView to list data from a table in my database. On of the
> > fields is a URL and when I click a row in the GridView I want the page to
> > automaticly open that link. How do I write code to an event i the GridView
> > so that when I click a row the page opens up the new link in another
> > window?
> >
> > Lars
>
> The GridView control has a HyperLink field, which might be what you
> are looking for. Just google GridView HyperLink.
>
>
>
Re: GridView
On Jan 30, 11:29=A0am, Angel <rodoo... [at] hotmail.com> wrote:
> David,
>
> I went and did a little checking and could not find the Target property or=
> its use. =A0Could you point us to an example or a link that talks about th=
is
> --
> aaa
>
I found it here http://msdn2.microsoft.com/en-us/library/system.web.ui.webco =
ntrols.hyperlinkfield.target.aspx
Re: GridView
On Jan 30, 11:10=A0am, Angel <rodoo... [at] hotmail.com> wrote:
> So you're saying the javascript I wrote becomes unnecessary? =A0
> --
> aaa
>
That's likely the case.
Re: GridView
Thanks, you know I seen that page before and never understood it until now
when you brought it up.
That's a simple solution.
Thanks again!
aaa
"gnewsgroup" wrote:
> On Jan 30, 11:29 am, Angel <rodoo... [at] hotmail.com> wrote:
> > David,
> >
> > I went and did a little checking and could not find the Target property or
> > its use. Could you point us to an example or a link that talks about this
> > --
> > aaa
> >
>
> I found it here http://msdn2.microsoft.com/en-us/library/system.web.ui.webco ntrols.hyperlinkfield.target.aspx
>
Re: GridView
Coul dyou give me a code example
My GridView is called gvTracks. My DataSourse is called sdsMP3Tracks.
Can you use only these two objects to open the mp3 file?
Lars
"gnewsgroup" <gnewsgroup [at] gmail.com> skrev i meddelandet
news:b10351b8-5ebc-4729-8888-dc9cc08d6f54 [at] i29g2000prf.google groups.com...
On Jan 30, 8:28 am, "rosoft" <supp... [at] RosoftEngineering.com> wrote:
> Hi
>
> I'm using a GridView to list data from a table in my database. On of the
> fields is a URL and when I click a row in the GridView I want the page to
> automaticly open that link. How do I write code to an event i the GridView
> so that when I click a row the page opens up the new link in another
> window?
>
> Lars
The GridView control has a HyperLink field, which might be what you
are looking for. Just google GridView HyperLink.
Re: GridView
Well that's the static way. I need to do it dynamicly. The view inlcudes
several URLs and I wan tto seleft ont view on the GrodView (GV) and then
goto that url.
Imagine a table with lots of hyper links. You click one of them and the url
in the hyper link opens. That's what I want to do. As an example goto the
page at http://www.rosoft.se/. It includes lots of Hyperlinks that I would
like to store in a database. Fields stored would be ShowText and URL. Using
a GV just shows the data in the table as strings. How do I transform the
text in the GV to hyperliks as in the example on my homepage.
Lars
"Angel" <rodoopus [at] hotmail.com> skrev i meddelandet
news:1FA7ED1E-E4EB-4991-82A0-D4AE61679153 [at] microsoft.com...
> Thanks, you know I seen that page before and never understood it until now
> when you brought it up.
>
> That's a simple solution.
>
> Thanks again!
> aaa
>
>
> "gnewsgroup" wrote:
>
>> On Jan 30, 11:29 am, Angel <rodoo... [at] hotmail.com> wrote:
>> > David,
>> >
>> > I went and did a little checking and could not find the Target property
>> > or
>> > its use. Could you point us to an example or a link that talks about
>> > this
>> > --
>> > aaa
>> >
>>
>> I found it here
>> http://msdn2.microsoft.com/en-us/library/system.web.ui.webco ntrols.hyperlinkfield.target.aspx
>>