How to raise events while clicking a datalist item or a particular Row??
-
Hai, I am using dotnetFramework1.1 with C# coding for my project. I need to display some Records.So i use DataList Control For that...But my Problem is that when I click a particular row ,i want to redirect to some other page showing the full description of that particular record.How is this possible????....Please hepl me to solve my proble.... thanks in advance Bijesh
-
Hai, I am using dotnetFramework1.1 with C# coding for my project. I need to display some Records.So i use DataList Control For that...But my Problem is that when I click a particular row ,i want to redirect to some other page showing the full description of that particular record.How is this possible????....Please hepl me to solve my proble.... thanks in advance Bijesh
Use Template Column in DataList control. Put the LinkControl in that template column. OR
<a href="http://mysite/anotherpage.aspx?id=1" > <%# DataBinder.Eval(Container.DataItem,"fieldName") %></a>
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
Use Template Column in DataList control. Put the LinkControl in that template column. OR
<a href="http://mysite/anotherpage.aspx?id=1" > <%# DataBinder.Eval(Container.DataItem,"fieldName") %></a>
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
Hello, i am new to asp.net.....By using "id=1" in query string How we can recognize each different recods data....I try this but some error comes....any modification need my code....... <%# DataBinder.Eval(Container.DataItem,"fieldName") %> -------------------------------------------------------------------------- > <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> <%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>
<%# DataBinder.Eval(Container.DataItem,"AD_DESCRIPTION") %>
Price: <%# DataBinder.Eval(Container.DataItem,"PRICE") %>
Location: <%# DataBinder.Eval(Container.DataItem,"LOCATION") %>
this is the code what i used or please help me by using template column link control..... thanks in advance -
Hello, i am new to asp.net.....By using "id=1" in query string How we can recognize each different recods data....I try this but some error comes....any modification need my code....... <%# DataBinder.Eval(Container.DataItem,"fieldName") %> -------------------------------------------------------------------------- > <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> <%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>
<%# DataBinder.Eval(Container.DataItem,"AD_DESCRIPTION") %>
Price: <%# DataBinder.Eval(Container.DataItem,"PRICE") %>
Location: <%# DataBinder.Eval(Container.DataItem,"LOCATION") %>
this is the code what i used or please help me by using template column link control..... thanks in advance<a href="http://mysite/anotherpage.aspx?id=<%# DataBinder.Eval(Container.DataItem,"fieldName") %>" > <%# DataBinder.Eval(Container.DataItem,"fieldName") %></a>
bijeshputhalath wrote:
please help me by using template column link control.....
<asp:DataList id="DataList1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server"> <ItemTemplate> <asp:HyperLink id="HyperLink1" runat="server" NavigateUrl="<%# DataBinder.Eval(Container.DataItem,"fieldName") %>"><%# DataBinder.Eval(Container.DataItem,"fieldName") %></asp:HyperLink> </ItemTemplate> </asp:DataList>
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
<a href="http://mysite/anotherpage.aspx?id=<%# DataBinder.Eval(Container.DataItem,"fieldName") %>" > <%# DataBinder.Eval(Container.DataItem,"fieldName") %></a>
bijeshputhalath wrote:
please help me by using template column link control.....
<asp:DataList id="DataList1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server"> <ItemTemplate> <asp:HyperLink id="HyperLink1" runat="server" NavigateUrl="<%# DataBinder.Eval(Container.DataItem,"fieldName") %>"><%# DataBinder.Eval(Container.DataItem,"fieldName") %></asp:HyperLink> </ItemTemplate> </asp:DataList>
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
Hello, Thank you so much....i use the first method.....it is working fine.....But in my query string, i send 3 parameters(Becoz if i send only one parameter if any records with same data i,it will display the first record)...But i cant retrieve it all the three and getting some error . ---------------------------------------------------------------------------- i used the following code in html > ,price=<%# DataBinder.Eval(Container.DataItem,"PRICE") %>,type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>"> <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> <%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>
<%# DataBinder.Eval(Container.DataItem,"AD_DESCRIPTION") %>
Price: <%# DataBinder.Eval(Container.DataItem,"PRICE") %>
Location: <%# DataBinder.Eval(Container.DataItem,"LOCATION") %>
---------------------------------------------------------------------------- and in my target page i use string search,type1,price; search=Request.QueryString["li"].ToString(); type1=Request.QueryString["type"].ToString(); price=Request.QueryString["price"].ToString(); Label1.Text=search; string sstr="select * FROM ads where AD_TITLE='"+search+"' && PRICE='"+price+"' && AD_TYPE='"+type1+"'"; sdr=conobj.reader(sstr); ---------------------------------------------------------------------------- But i get the following error Server Error in '/approvedplotfinal' Application. -------------------------------------------------------------------------------- Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 45: Line 46: search=Request.QueryString["li"].ToString(); Line 47: type1=Request.QueryString["type" -
Hello, Thank you so much....i use the first method.....it is working fine.....But in my query string, i send 3 parameters(Becoz if i send only one parameter if any records with same data i,it will display the first record)...But i cant retrieve it all the three and getting some error . ---------------------------------------------------------------------------- i used the following code in html > ,price=<%# DataBinder.Eval(Container.DataItem,"PRICE") %>,type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>"> <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> <%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>
<%# DataBinder.Eval(Container.DataItem,"AD_DESCRIPTION") %>
Price: <%# DataBinder.Eval(Container.DataItem,"PRICE") %>
Location: <%# DataBinder.Eval(Container.DataItem,"LOCATION") %>
---------------------------------------------------------------------------- and in my target page i use string search,type1,price; search=Request.QueryString["li"].ToString(); type1=Request.QueryString["type"].ToString(); price=Request.QueryString["price"].ToString(); Label1.Text=search; string sstr="select * FROM ads where AD_TITLE='"+search+"' && PRICE='"+price+"' && AD_TYPE='"+type1+"'"; sdr=conobj.reader(sstr); ---------------------------------------------------------------------------- But i get the following error Server Error in '/approvedplotfinal' Application. -------------------------------------------------------------------------------- Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 45: Line 46: search=Request.QueryString["li"].ToString(); Line 47: type1=Request.QueryString["type"When you are posting the HTML code, please check "Ignore HTML tags in this message". otherwise, all code will be strips off.. Can you post your code again?
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
When you are posting the HTML code, please check "Ignore HTML tags in this message". otherwise, all code will be strips off.. Can you post your code again?
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
this the target page URL::: "http://localhost/approvedplotfinal/classified/AddView.aspx?li=search of a new plot,type=Wanted,price=5000" My target page code like this----------------------------------------------------------------------------- string search,type1,price; //Session["li"].ToString(); search=Request.QueryString["li"].ToString(); type1=Request.QueryString["type"].ToString(); price=Request.QueryString["price"].ToString(); Label1.Text=search; string sstr="select * FROM ads where AD_TITLE='"+search+"'&& AD_TYPE='"+type1+"' && PRICE='"+price+"' "; sdr=conobj.reader(sstr); while(sdr.Read()) { } ---------------------------------------------------------------------------- This is the htmal part > ,type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>,price=<%# DataBinder.Eval(Container.DataItem,"PRICE") %>"> <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> <%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>
<%# DataBinder.Eval(Container.DataItem,"AD_DESCRIPTION") %>
Price: <%# DataBinder.Eval(Container.DataItem,"PRICE") %>
Location: <%# DataBinder.Eval(Container.DataItem,"LOCATION") %>
---------------------------------------------------------------------------- please help..... i need to hit a target page with these parameters .... thanks Biju -
this the target page URL::: "http://localhost/approvedplotfinal/classified/AddView.aspx?li=search of a new plot,type=Wanted,price=5000" My target page code like this----------------------------------------------------------------------------- string search,type1,price; //Session["li"].ToString(); search=Request.QueryString["li"].ToString(); type1=Request.QueryString["type"].ToString(); price=Request.QueryString["price"].ToString(); Label1.Text=search; string sstr="select * FROM ads where AD_TITLE='"+search+"'&& AD_TYPE='"+type1+"' && PRICE='"+price+"' "; sdr=conobj.reader(sstr); while(sdr.Read()) { } ---------------------------------------------------------------------------- This is the htmal part > ,type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>,price=<%# DataBinder.Eval(Container.DataItem,"PRICE") %>"> <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> <%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>
<%# DataBinder.Eval(Container.DataItem,"AD_DESCRIPTION") %>
Price: <%# DataBinder.Eval(Container.DataItem,"PRICE") %>
Location: <%# DataBinder.Eval(Container.DataItem,"LOCATION") %>
---------------------------------------------------------------------------- please help..... i need to hit a target page with these parameters .... thanks Bijubijeshputhalath wrote:
li=<%#DataBinder.Eval(Container.DataItem,"AD_TITLE") %>,type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>,price=<%# DataBinder.Eval(Container.DataItem,"PRICE")
should be "&" (not ",") eg:
http://myurl.com/page1.aspx?a=1&b=2&c=3
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
bijeshputhalath wrote:
li=<%#DataBinder.Eval(Container.DataItem,"AD_TITLE") %>,type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>,price=<%# DataBinder.Eval(Container.DataItem,"PRICE")
should be "&" (not ",") eg:
http://myurl.com/page1.aspx?a=1&b=2&c=3
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
Hello , I try with "&" also Before your suggetion with & operator....But the same error comes still..... my problem is that...How can i retrieve each query string value li=<%#DataBinder.Eval(Container.DataItem,"AD_TITLE") %>&type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>&price=<%# DataBinder.Eval(Container.DataItem,"PRICE") With these coding ,it will work or not???? string search,type1,price; search=Request.QueryString["li"].ToString(); type1=Request.QueryString["type"].ToString(); price=Request.QueryString["price"].ToString(); Label1.Text=search; string sstr="select * FROM ads where AD_TITLE='"+search+"'&& AD_TYPE='"+type1+"' && PRICE='"+price+"' "; sdr=conobj.reader(sstr); while(sdr.Read()) { } what is my mistake ...????Please help me.... with regards and thanks Biju
-
Hello , I try with "&" also Before your suggetion with & operator....But the same error comes still..... my problem is that...How can i retrieve each query string value li=<%#DataBinder.Eval(Container.DataItem,"AD_TITLE") %>&type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>&price=<%# DataBinder.Eval(Container.DataItem,"PRICE") With these coding ,it will work or not???? string search,type1,price; search=Request.QueryString["li"].ToString(); type1=Request.QueryString["type"].ToString(); price=Request.QueryString["price"].ToString(); Label1.Text=search; string sstr="select * FROM ads where AD_TITLE='"+search+"'&& AD_TYPE='"+type1+"' && PRICE='"+price+"' "; sdr=conobj.reader(sstr); while(sdr.Read()) { } what is my mistake ...????Please help me.... with regards and thanks Biju
Okay. Lets debug the application.. Let's say we have two pages called page1 and page2. We will divide the issue into small pieces ~ 1. Using static data in page1 2. Retrieving the data in page2 3. Checking whether the SQL statment is correct or not 4. Changing static data to dynamic data in page1. 1. Using static data in page1 We will remove all dynamic value in A link to avoid NULL value and "". Note: dynamic value means <%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>.
<a href="http://localhost/approvedplotfinal/classified/page2.aspx?li=<%#DataBinder.Eval(Container.DataItem,"AD_TITLE") %>,type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>,price=<%# DataBinder.Eval(Container.DataItem,"PRICE") %>"> <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> </a>
We will replace all dynamic value with all static value.<a href="http://localhost/approvedplotfinal/classified/page2.aspx?li=mytitle&type=mytype&price=100" > <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> </a>
Run the application to check whether there is any error or not. 2. Retrieving the data in page2 Forget about other code in page2. We will assume that we have only the following lines in Page Load. search=Request.QueryString["li"].ToString(); type1=Request.QueryString["type"].ToString(); price=Request.QueryString["price"].ToString(); - Set the breakpoint at "search" variable. - Run the application. (Page1 is start-up page) - Click the link in page1. (it will take you to page2.) - Check whether "Request.QueryString["li"]
" is null or not. - Check whether "Request.QueryString["type"]
" is null or not. - Check whether "Request.QueryString["price"]
" is null or not. Note: All three parameters should not be NULL. If you are getting NULL then let me know. 3. Checking whether the SQL statment is correct or not Which Database are you using? If it's SQL Server, you don't need "&&".string sstr="select * FROM ads where AD_TITLE='"+search+"'&& AD_TYPE='"+type1+"' && PRICE='"+price+"' ";
So, we will change something like that.string sstr="select * FROM ads where AD_TITLE='" + search + "' AND AD_TYPE = '" + type1 + "' AND PRICE='"+ price + "'";
- Check this variable "sstr" in Quick Watch or Immediate Window. - Copy the string -
Okay. Lets debug the application.. Let's say we have two pages called page1 and page2. We will divide the issue into small pieces ~ 1. Using static data in page1 2. Retrieving the data in page2 3. Checking whether the SQL statment is correct or not 4. Changing static data to dynamic data in page1. 1. Using static data in page1 We will remove all dynamic value in A link to avoid NULL value and "". Note: dynamic value means <%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>.
<a href="http://localhost/approvedplotfinal/classified/page2.aspx?li=<%#DataBinder.Eval(Container.DataItem,"AD_TITLE") %>,type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>,price=<%# DataBinder.Eval(Container.DataItem,"PRICE") %>"> <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> </a>
We will replace all dynamic value with all static value.<a href="http://localhost/approvedplotfinal/classified/page2.aspx?li=mytitle&type=mytype&price=100" > <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> </a>
Run the application to check whether there is any error or not. 2. Retrieving the data in page2 Forget about other code in page2. We will assume that we have only the following lines in Page Load. search=Request.QueryString["li"].ToString(); type1=Request.QueryString["type"].ToString(); price=Request.QueryString["price"].ToString(); - Set the breakpoint at "search" variable. - Run the application. (Page1 is start-up page) - Click the link in page1. (it will take you to page2.) - Check whether "Request.QueryString["li"]
" is null or not. - Check whether "Request.QueryString["type"]
" is null or not. - Check whether "Request.QueryString["price"]
" is null or not. Note: All three parameters should not be NULL. If you are getting NULL then let me know. 3. Checking whether the SQL statment is correct or not Which Database are you using? If it's SQL Server, you don't need "&&".string sstr="select * FROM ads where AD_TITLE='"+search+"'&& AD_TYPE='"+type1+"' && PRICE='"+price+"' ";
So, we will change something like that.string sstr="select * FROM ads where AD_TITLE='" + search + "' AND AD_TYPE = '" + type1 + "' AND PRICE='"+ price + "'";
- Check this variable "sstr" in Quick Watch or Immediate Window. - Copy the stringHai, sorry for delay... It is very helpful....i done as per your information...it is working fine Now my problem solved...Thanks alot.....But Now arise a new problem..How to set paging in this.???...Please give any idea or sample code..... instead of "," i use '&'in this code......it is very helpful ----------------------------------------------------------------------------- ,type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>,price=<%# DataBinder.Eval(Container.DataItem,"PRICE") %>"> <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> ----------------------------------------------------------------------------- thanks once again Biju
-
Hai, sorry for delay... It is very helpful....i done as per your information...it is working fine Now my problem solved...Thanks alot.....But Now arise a new problem..How to set paging in this.???...Please give any idea or sample code..... instead of "," i use '&'in this code......it is very helpful ----------------------------------------------------------------------------- ,type=<%# DataBinder.Eval(Container.DataItem,"AD_TYPE") %>,price=<%# DataBinder.Eval(Container.DataItem,"PRICE") %>"> <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %> ----------------------------------------------------------------------------- thanks once again Biju
bijeshputhalath wrote:
It is very helpful.
It is helpful for you. Please don't forget to vote the message. :) Thanks.
bijeshputhalath wrote:
.How to set paging in this.???...Please give any idea or sample code.....
You can google about there are a lot of helpful codes for this. Ask the DotNetJunkies: DataList Paging[^] Implementing Paging in a DataList Control...[^] Feel free to let me know if you have any problem in implementing.
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
bijeshputhalath wrote:
It is very helpful.
It is helpful for you. Please don't forget to vote the message. :) Thanks.
bijeshputhalath wrote:
.How to set paging in this.???...Please give any idea or sample code.....
You can google about there are a lot of helpful codes for this. Ask the DotNetJunkies: DataList Paging[^] Implementing Paging in a DataList Control...[^] Feel free to let me know if you have any problem in implementing.
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
Hai How to edit and update a particular DataList item?? Thanks and regards Biju
-
Hai How to edit and update a particular DataList item?? Thanks and regards Biju
bijeshputhalath wrote:
How to edit and update a particular DataList item??
If you wanna do inserting, editing and deleting the record, I would suggest you to use "DataGrid" or "GridView" control instead of "DataList".
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)