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

datagrid-passing-parameters-problem.html

I have a datagrid with a hyperlink field. It passes a parameter but I need
it to pass two. I need two of the parameters to be querystrings but I have no idea how to add them the hyperlink column if any one know about this then please help me .
here is my code:

[HTML]
<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False" AlternatingItemStyle-BorderStyle="Dotted" BorderColor="Black" BorderStyle="Solid" Width="650px">
<AlternatingItemStyle BorderStyle="Dotted"></AlternatingItemStyle>
<Columns>
<asp:BoundColumn DataField="NominatedByfirstname" HeaderText="Nominated By First name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NominatedByLastName" HeaderText="Nominated By Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineefirstName" HeaderText="Nominee First Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeLastName" HeaderText="Nominee Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeDept" HeaderText="Nominee Dept">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DateCreated" HeaderText="Date Created">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:HyperLinkColumn Text="Detail" HeaderStyle-BackColor="#316AC5" HeaderText="Detail" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="True" DataNavigateUrlField="employeenominationid" DataNavigateUrlFormatString="Reasonfornominating.a spx?employeenominationid={0}"></asp:HyperLinkColumn>

</Columns>
</asp:datagrid>

[/HTML]
Aug 29 '07 #1
8 1555
nateraaaa
663 Expert 512MB
I have a datagrid with a hyperlink field. It passes a parameter but I need
it to pass two. I need two of the parameters to be querystrings but I have no idea how to add them the hyperlink column if any one know about this then please help me .
here is my code:

[HTML]
<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False" AlternatingItemStyle-BorderStyle="Dotted" BorderColor="Black" BorderStyle="Solid" Width="650px">
<AlternatingItemStyle BorderStyle="Dotted"></AlternatingItemStyle>
<Columns>
<asp:BoundColumn DataField="NominatedByfirstname" HeaderText="Nominated By First name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NominatedByLastName" HeaderText="Nominated By Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineefirstName" HeaderText="Nominee First Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeLastName" HeaderText="Nominee Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeDept" HeaderText="Nominee Dept">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DateCreated" HeaderText="Date Created">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:HyperLinkColumn Text="Detail" HeaderStyle-BackColor="#316AC5" HeaderText="Detail" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="True" DataNavigateUrlField="employeenominationid" DataNavigateUrlFormatString="Reasonfornominating.a spx?employeenominationid={0}"></asp:HyperLinkColumn>
<Columns>
</asp:datagrid>
[/HTML]
Try doing this. Create a new TemplateColumn and an ItemTemplate. Create a new hyperlink in your ItemTemplate.

You will need to do the following:

<asp:TemplateColumn HeaderText="Order">

<ItemTemplate>

<asp:Hyperlink runat="server"
Text='<%#DataBinder.Eval(Container.DataItem,"Order ID")%>' NavigateUrl='<%#
"Reasonfornominating.aspx?employeenominationid =" + DataBinder.Eval(Container.DataItem,"employeenomina tionid") +
"&String2=" + DataBinder.Eval(Container.DataItem,"String2")%>'
ID="Hyperlink1" NAME="Hyperlink1"/>

</ItemTemplate>

</asp:TemplateColumn>

employeenominationid and String2 should both be in the dataset used as the datasource of your datagrid. Give this a try and let us know if you encounter any more problems.

Nathan
Aug 29 '07 #2
now i got this error

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1010: Newline in constant

Source Error:



Line 112: #line default
Line 113: #line hidden
Line 114:
Line 115:
Line 116: #line 46 "http://localhost/Employee Nomination/NominationReport.aspx"

code is look like this:

[HTML]
<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False" AlternatingItemStyle-BorderStyle="Dotted"
BorderColor="Black" BorderStyle="Solid" Width="650px">
<AlternatingItemStyle BorderStyle="Dotted"></AlternatingItemStyle>
<Columns>
<asp:BoundColumn DataField="NominatedByfirstname" HeaderText="Nominated By First name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NominatedByLastName" HeaderText="Nominated By Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineefirstName" HeaderText="Nominee First Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeLastName" HeaderText="Nominee Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeDept" HeaderText="Nominee Dept">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DateCreated" HeaderText="Date Created">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText=Detail>
<ItemTemplate>
<asp:HyperLink Runat=server NavigateUrl=<%#"Reasonfornominating.aspx?employeen ominationid=" +
DataBinder.Eval(Container.DataItem,"employeenomina tionid") +<BR>"&datecreated="+ DataBinder.Eval(Container.DataItem,"datecreated%> ID="Hyperlink1"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
[/HTML]
[PHP]
and one more thing i neeg to teel you i didn't found the property call NAME AND TEXT
[/PHP]
Aug 29 '07 #3
nateraaaa
663 Expert 512MB
now i got this error

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1010: Newline in constant

Source Error:



Line 112: #line default
Line 113: #line hidden
Line 114:
Line 115:
Line 116: #line 46 "http://localhost/Employee Nomination/NominationReport.aspx"

code is look like this:

[HTML]
<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False" AlternatingItemStyle-BorderStyle="Dotted"
BorderColor="Black" BorderStyle="Solid" Width="650px">
<AlternatingItemStyle BorderStyle="Dotted"></AlternatingItemStyle>
<Columns>
<asp:BoundColumn DataField="NominatedByfirstname" HeaderText="Nominated By First name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NominatedByLastName" HeaderText="Nominated By Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineefirstName" HeaderText="Nominee First Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeLastName" HeaderText="Nominee Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeDept" HeaderText="Nominee Dept">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DateCreated" HeaderText="Date Created">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText=Detail>
<ItemTemplate>
<asp:HyperLink Runat=server NavigateUrl=<%#"Reasonfornominating.aspx?employeen ominationid=" +
DataBinder.Eval(Container.DataItem,"employeenomina tionid") +<BR>"&datecreated="+ DataBinder.Eval(Container.DataItem,"datecreated%> ID="Hyperlink1"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
[/HTML]
[PHP]
and one more thing i neeg to teel you i didn't found the property call NAME AND TEXT
[/PHP]
Here is what you need to do to fix this error.
It appears that you did not close your Eval statement

[HTML]DataBinder.Eval(Container.DataItem,"datecreated%> [/HTML]
replace with this
[HTML]DataBinder.Eval(Container.DataItem,"datecreated")% > [/HTML]
Also not sure why there is a <BR> in your code (that may have been added inadvertently but make sure that is not in your code).
You can assign the text value of the hyperlink in the codebehind file.
Expand|Select|Wrap|Line Numbers
  1. HyperLink1.Text = "Whatever you want";
Nathan
Aug 29 '07 #4
nateraaaa
663 Expert 512MB
It appears that you did not close your Eval statement

[HTML]DataBinder.Eval(Container.DataItem,"datecreated%> [/HTML]
replace with this
[HTML]DataBinder.Eval(Container.DataItem,"datecreated")% > [/HTML]
Also not sure why there is a <BR> in your code (that may have been added inadvertently but make sure that is not in your code).
You can assign the text value of the hyperlink in the codebehind file.
Expand|Select|Wrap|Line Numbers
  1. HyperLink1.Text = "Whatever you want";
Nathan
Aug 29 '07 #5
where is the answer i didn't find it

Here is what you need to do to fix this error.
It appears that you did not close your Eval statement

[HTML]DataBinder.Eval(Container.DataItem,"datecreated%> [/HTML]
replace with this
[HTML]DataBinder.Eval(Container.DataItem,"datecreated")% > [/HTML]
Also not sure why there is a <BR> in your code (that may have been added inadvertently but make sure that is not in your code).
You can assign the text value of the hyperlink in the codebehind file.
Expand|Select|Wrap|Line Numbers
  1. HyperLink1.Text = "Whatever you want";
Nathan
Aug 29 '07 #6
hey i am still getting the same error please help me
code is here
[HTML]

<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False" AlternatingItemStyle-BorderStyle="Dotted"
BorderColor="Black" BorderStyle="Solid" Width="650px">
<AlternatingItemStyle BorderStyle="Dotted"></AlternatingItemStyle>
<Columns>
<asp:BoundColumn DataField="NominatedByfirstname" HeaderText="Nominated By First name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NominatedByLastName" HeaderText="Nominated By Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineefirstName" HeaderText="Nominee First Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeLastName" HeaderText="Nominee Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeDept" HeaderText="Nominee Dept">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DateCreated" HeaderText="Date Created">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText=Detail>
<ItemTemplate>
<asp:HyperLink Runat=server NavigateUrl=<%#"Reasonfornominating.aspx?employeen ominationid="+DataBinder.Eval(Container.DataItem," employeenominationid")+"&datecreated="+ DataBinder.Eval(Container.DataItem,"datecreated%> ID="Hyperlink1"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
[/HTML]
Aug 29 '07 #7
nateraaaa
663 Expert 512MB
Replace this code

<asp:HyperLink Runat=server NavigateUrl=<%#"Reasonfornominating.aspx?employeen ominationid="+DataBinder.Eval(Container.DataItem," employeenominationid")+"&datecreated="+ DataBinder.Eval(Container.DataItem,"datecreated%> //missing the ") to close the Eval statement on this line.
ID="Hyperlink1"></asp:HyperLink>

with this code

<asp:HyperLink Runat=server NavigateUrl=<%#"Reasonfornominating.aspx?employeen ominationid="+DataBinder.Eval(Container.DataItem," employeenominationid")+"&datecreated="+ DataBinder.Eval(Container.DataItem,"datecreated")% > ID="Hyperlink1"></asp:HyperLink>
Aug 29 '07 #8
tanks very much for helping me thanks a lot my probelm is solved
Aug 29 '07 #9

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

Similar topics

5
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within...
3
by: Quetzal | last post by:
Hello, I have a dataset populated using an XML file. The schema has hierarchical components. Let's say <a><b></b></a>. I have created a datagrid and I have assigned a datastyle and then...
0
by: BK Kim | last post by:
Hello. I am trying to use dataGrid in a dataGrid, meaning first DataGrid displays some information and on each row, it is going to have another datagrid to display detailed information. I was...
1
by: thegame | last post by:
Filling One DataGrid Based on Selection from Another DataGrid - Both in Separate User Controls Hello, I have an interesting dilemma. I have an ASPX page with two user controls (two ASCXs). ...
8
by: Strahimir Antoljak | last post by:
I bound a DataGrid to a table (I tried with a DataView too). I removed the row from the table, and then inserted a new row at the same row index. the table gets the row to the right position, but...
7
by: Dave | last post by:
Are there any add-on products or samples available that can do the following in an vb.net datagrid I want to compare 2 rows in a datagrid - one row from one database and another row for another...
2
by: Nina | last post by:
Hi there, I've tried everything that I know to prevent usre resizing datagrid columns, but nothing works. Following are the code that I used. Please tell me what's wrong with them. Thank you....
3
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If...
0
by: rn5a | last post by:
A DataGrid control displays records from a SQL Server 2005 DB table. The AllowSorting property of the DataGrid has been set to True & the SortExpressions of the BoundColumns have been set to the...
8
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report...
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
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
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
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.