Click here to Skip to main content
16,005,316 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
bijeshputhalath15-Aug-07 23:35
bijeshputhalath15-Aug-07 23:35 
GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
Michael Sync15-Aug-07 23:51
Michael Sync15-Aug-07 23:51 
GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
bijeshputhalath16-Aug-07 1:21
bijeshputhalath16-Aug-07 1:21 
GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
Michael Sync16-Aug-07 1:27
Michael Sync16-Aug-07 1:27 
GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
bijeshputhalath16-Aug-07 2:41
bijeshputhalath16-Aug-07 2:41 
GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
Michael Sync16-Aug-07 4:18
Michael Sync16-Aug-07 4:18 
GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
bijeshputhalath16-Aug-07 5:30
bijeshputhalath16-Aug-07 5:30 
GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
Michael Sync16-Aug-07 6:33
Michael Sync16-Aug-07 6:33 
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") %>"><br />
                        <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %><br />
</a><br />


We will replace all dynamic value with all static value.

<br />
<a  href="http://localhost/approvedplotfinal/classified/page2.aspx?li=mytitle&type=mytype&price=100" ><br />
     <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %><br />
                    </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+"' ";<br />


So, we will change something like that.

string sstr="select * FROM ads where AD_TITLE='" + search + "' AND AD_TYPE = '" + type1 + "'     AND PRICE='"+ price + "'";<br />


- Check this variable "sstr" in Quick Watch or Immediate Window.
- Copy the string from Quick Watch or Immediate Window.
- Paste in Query Analyzer and Run it.
(You should not get any error. this is about checking whether the SQL statement is correct or not.)

4. Changing static data to dynamic data in page1.

It is still working fine. we will remove the static code in page and replace with dynamic code.
So, the following code will be used again..

<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") %>"><br />
                        <%# DataBinder.Eval(Container.DataItem,"AD_TITLE") %><br />
</a><br />


- Run the application
- Click the link in page1.
- Check the Request.QueryString and SQL Statement in page2.

if it's working until now, you are done.. Smile | :)

Please follow the step as I mention here.. let me know the result..



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. Smile | :)

GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
bijeshputhalath16-Aug-07 19:25
bijeshputhalath16-Aug-07 19:25 
GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
Michael Sync16-Aug-07 20:09
Michael Sync16-Aug-07 20:09 
GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
bijeshputhalath16-Aug-07 23:39
bijeshputhalath16-Aug-07 23:39 
GeneralRe: How to raise events while clicking a datalist item or a particular Row?? Pin
Michael Sync16-Aug-07 23:48
Michael Sync16-Aug-07 23:48 
Questionphoto gallery (urgent!) Pin
Milind Panchal15-Aug-07 21:34
Milind Panchal15-Aug-07 21:34 
AnswerRe: photo gallery (urgent!) Pin
N a v a n e e t h15-Aug-07 21:40
N a v a n e e t h15-Aug-07 21:40 
GeneralRe: photo gallery (urgent!) Pin
Milind Panchal15-Aug-07 21:42
Milind Panchal15-Aug-07 21:42 
GeneralRe: photo gallery (urgent!) Pin
Michael Sync15-Aug-07 22:02
Michael Sync15-Aug-07 22:02 
Questionhow do i Filter extensions in FileUpload Control Pin
Amit.Amit.Amit...15-Aug-07 21:22
Amit.Amit.Amit...15-Aug-07 21:22 
AnswerRe: how do i Filter extensions in FileUpload Control Pin
Michael Sync15-Aug-07 21:25
Michael Sync15-Aug-07 21:25 
AnswerRe: how do i Filter extensions in FileUpload Control Pin
N a v a n e e t h15-Aug-07 21:33
N a v a n e e t h15-Aug-07 21:33 
AnswerRe: how do i Filter extensions in FileUpload Control Pin
metallica_rock1015-Aug-07 23:09
metallica_rock1015-Aug-07 23:09 
AnswerRe: how do i Filter extensions in FileUpload Control Pin
metallica_rock1015-Aug-07 23:09
metallica_rock1015-Aug-07 23:09 
AnswerRe: how do i Filter extensions in FileUpload Control Pin
mangrovecm15-Aug-07 23:52
mangrovecm15-Aug-07 23:52 
GeneralRe: how do i Filter extensions in FileUpload Control Pin
Christian Graus15-Aug-07 23:26
protectorChristian Graus15-Aug-07 23:26 
GeneralRe: how do i Filter extensions in FileUpload Control Pin
Michael Sync16-Aug-07 0:03
Michael Sync16-Aug-07 0:03 
GeneralRe: how do i Filter extensions in FileUpload Control Pin
Amit.Amit.Amit...16-Aug-07 1:31
Amit.Amit.Amit...16-Aug-07 1:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.