I am trying to solve this issue in the code behind file, but I am trying almost two days now without any success.
The thing is that the label is in templatefield within gridview and I am having hard time to solve how I can get to the label in the gridview, check the text and set the forecolor depending on the text.
If you have good example how I can solve this in code behind file I will be more then pleased to accept that.
Ahhh ok. So, from my experience, you're probably going to want to hook into the databind event on a row, find your label control using fincontrol on the row being passed and then change the colour there. Example:
protectedvoid GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
Label myLabel = (Label)e.Row.FindControl("yourlabel");
if (myLabel.Text == "Jack")
'change the colour here
There might be an easier way but that's just off the top of my head.
Looks like you are setting the Label text at runtime and server side. Why using a Eval container?
Directly in the server side, use a switch statment, based on various case, set the back/fore color of the label and also set the text!
for (int i = 0; i < gvPpl.Rows.Count; i++)
Label lblL = (Label)gvPpl.Rows[i].Cells.FindControl("lblFirstName");
but nothing comes up.
Can you give me some example how I can do that, and how I can set the forecolor afterwards. Eval container was there before I started working on this code.
Please advice if I can/need to use something else and still get the same data.
This is becasue, the Response.End method ends the page execution and shifts the execution to the Application_EndRequest event in the application's event pipeline. The line of code that follows Response.End is not executed.
For Response.End, call the HttpContext.Current.ApplicationInstance.CompleteRequest method instead of Response.End to bypass the code execution to the Application_EndRequest event.
If you use
1. Response.End，you should try ApplicationInstance.CompleteRequest
2. Response.Redirect，please change it to Response.Redirect(String url, bool endResponse)，set endResponse as false. For example,
Response.Redirect ("nextpage.aspx", false);
3. Server.Transfer，please change it to Server.Execute.
I divided my application into 2 different web apps. I have created a control in the first web app and i need to reference it in the second application. Is it possible to do so? I am trying to drag and drop the control but when debugging i am getting problems.
First of all, whether it's a Custom control or a User control? Heading of your query says a usercontrol.
Had it been a custom control, you can include that as a reference and drag-drop it on your designer.
If it's a user control that too in another project, it would be difficult for you to refer. Either include that user control in your project where you need it or design a similar one.
Looks like you are trying to access data using a procedure or table valued function and getting this error.
If you check the stored procedure(SP) or table valued function(TVF) then you will find that they expect some parameters in order to run. You are calling TVF/executing SP without suppling those parameters.
suppose i have button in my page and i want that when user click on that button then i will call gridview sort event
explicitly with proper parameter. is it possible if yes then please guide me with sample code.
thanks in advance
please help me in asp .net on clicking a button in left frame the data related to it has to appear in right.I want the code also.
this the model in which i want that is with frames. but in this link it is provided in java script . but i want the coding in asp.net
u plz check the link in that model am designing my website. In that plz select frame layout. I want the coding in asp.net. some of my friends have suggested to use either ajax or javaScrpit. But my requirement is only in asp.net
Last Visit: 31-Dec-99 18:00 Last Update: 23-May-22 1:42