|
Thank you for your kind info.
This is my company requirement to do so. I will discuss about it with the authority person.
Thank You
|
|
|
|
|
We can use imageUrl to display images in treeview. My images are stored in SQL database as images. How can we display the image from database in treeview?
|
|
|
|
|
Create a Generic handler to return the image from sql.
Here is a simple example:
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim id As String = context.Request.QueryString("imageID")
Dim MyImage as Byte()
context.Response.ContentType = "image/png"
context.Response.BinaryWrite(MyImage)
End Sub
And your imageurl will be GenericHandler.ashx?imageID=...
|
|
|
|
|
|
foreach (GridViewRow row in GridView_pm.Rows)
{
if (row.Cells["MachineTypeNo"].Value.ToString().Equals(txt_search.Text))
{
GridView_pm.Rows[row.Index].DefaultCellStyle.BackColor =("yellow");
}
else
{
GridView_pm.Rows[row.Index].Visible = false;
}
I don't really sure about it..can you pls help me.
|
|
|
|
|
You should write the code in row data bound event of the gridview. The following code will change the value of the corresponding row to yellow color.
protected void GridView_pm_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (!String.IsNullOrWhiteSpace(txt_search.Text))
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
var rowView = e.Row.DataItem as DataRowView;
if (String.Compare(rowView["MachineTypeNo"].ToString(), txt_search.Text,true) == 0)
{
e.Row.BackColor = System.Drawing.Color.Yellow;
}
else
{
e.Row.BackColor = System.Drawing.Color.White;
}
}
}
}
Thanks & Regards
Taleeb
(trystwithdotnet.blogspot.com)
modified 29-Sep-15 4:01am.
|
|
|
|
|
Thank you for your sharing..
|
|
|
|
|
<asp:ImageButton ID="imgbtn_search" runat="server" BorderStyle="Solid" ImageUrl="~/images/search.png" style="height: 28px; position: relative; top: 11px; left: 934px; width: 30px;" OnClick="imgbtn_search_Click1"/>
<asp:TextBox ID="txt_search" placeholder="search by Machine and DD/MM/YYYY " runat="server" style="z-index: 1; left: 682px; top: 20px; position: absolute; width: 237px; bottom: 271px"></asp:TextBox>
modified 28-Sep-15 4:08am.
|
|
|
|
|
Simple, it submits your data. The "another page" would be the page where your form has to land after submission. Preventing the user from submitting a form via Enter key, is a bad UX, in my opinion. User would want to use keyboard for the submission process and you would be preventing him from doing so.
I have never used ASP.NET Web Forms, but I do know that even that form gets translated to HTML while rendering, so you can control that via JavaScript. Following script would suffice.
$('input[type="text"]').keydown(function (e) {
if(e.which == 13) {
return false;
}
});
This would do the trick for you, but I would suggest that you do not do so. Let user submit the form using Enter key.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Thank you soo much for your kind answer.
what I actually mean is I created a search button. when I search for the result and press on ENTER, its going to default page. when I manually click on search button its showing the result.
|
|
|
|
|
We can't say from what you've posted. When you press enter in a textbox the first button of the form is clicked. So you'll need to find the first button on your form and try and work out from that what is happening. It could be clicking that button is activating js or something, we don't know.
|
|
|
|
|
Thank you soo much for your kind answer.
what I actually mean is I created a search button. when I search for the result and press on ENTER, its going to default page. when I manually click on search button its showing the result.
|
|
|
|
|
|
I tried that too, its work. Now the problem is I have 3 buttons in 1 panel. There are search, submit and log out. for the submit button I created as once insert data and click on submit button it will go to another page but when I use defaultbutton its remaining on the same page. because of that I did not use defaultbutton in panel.
Thank you
|
|
|
|
|
HI,
I want to know that,
What is the important of ISPostBack in asp.net???
Can AnyOne help???
|
|
|
|
|
|
IsPostBack is a property by which you can check that is your page is loading first time or postbacking.
In ASP.NET application every event (like clicking a button) causing postback of same page. So the code block written in the page load will execute every time.
If you does not want to execute it everytime then enclose that code block with a if(!IsPostBack){}.
PANKAJ MAURYA
SOFTWARE ENGINEER (Daffodil S/W)
Gurgaon
|
|
|
|
|
HI,
IQuote: IsPostBack is a Page level property, that can be used to determine whether the page is being loaded in response to a client postback, or if it is being loaded and accessed for the first time.
example.
if(!ispostback){
}
else
{
}
When page response very first time then it go into if condition, after that your else statement will call always.
hi
|
|
|
|
|
This property is used to restrict the postback of page every time unnecessarily.
check like below in you code.
if(!IsPostback)
{
//this is your first visit.
}
else
{
//this is not your first visit.
}
Sridhar Thota.
|
|
|
|
|
I have a confusion here.
Both HtmlTextWriter and HtmlTable.RenderControl gives similar outputs then what is the difference considering the performance.
Thanks
|
|
|
|
|
|
Dear experts,
I do really appreciate your highly valued expertise.
I am trying to think up a solution but I am frozen.
First we have two tables ( I didn't design it in case it is flawed), Emp table and Angulers table.
The emp table contains the following fields:
EmpID,
EmpName
Password
Dept
And several others but those above are the relevant ones.
Then Angulers table with following relevant fieldnames:
EmpID - Foreign Key to Emp table
ManagerID -related to EmpID on Emp table
Status (Status has a value of Pending or Done)
The history:
The process is that employees will log in first to register their grievances and suggest a remedy.
Once an employee is done and clicks the Done button, next time that employee logs in, that employee is no longer allowed to make any changes.
By the way, employees log in with empID as username and Password as password.
This works fine.
Now that that employee is done, his or her manager then logs in to a page called EmployeeSummary.aspx to view a list of his/her employees.
Each manager can view his/her employee based on his/her ID and the department that s/he and his/her employees belong to.
This is where I am having problem.
How do I make a manager log into EmployeeSummary.aspx page and only see those employees that are in his/her department?
Here is the code I am working with but it is coming blank when I run it.
<div align="center">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" AllowPaging="true"
OnPageIndexChanging="OnPageIndexChanging" PageSize="10">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="ManagerID,department"
DataNavigateUrlFormatString="employeeDetails.aspx?ID={0}&Dept={1}" Text="Add Comments" />
<asp:BoundField ItemStyle-Width="200px" DataField="empname" HeaderText="Employee Name" />
<asp:BoundField ItemStyle-Width="250px" DataField="department" HeaderText="Department" />
</Columns>
</asp:GridView>
</div>
--Code Behind:
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Me.BindGrid()
End If
End Sub
Private Sub BindGrid()
Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("SELECT e.empID, e.empname, e.department, a.managerID, a.status FROM Emp e INNER JOIN Angulers a ON a.empID = e.empID WHERE a.status = 'Done' and e.ManagerID = '"&querystring("ID") & "' and e.department = '"&uerystring("dept") & "' ")
'We use parametized query to prevent sql injection attack
' Dim p1 As New SqlParameter("@dept", Session("dept"))
'cmd.Parameters.Add(p1)
Using sda As New SqlDataAdapter()
cmd.Connection = con
sda.SelectCommand = cmd
Using dt As New DataTable()
sda.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
End Using
End Using
End Using
End Using
End Sub
Protected Sub OnPageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
GridView1.PageIndex = e.NewPageIndex
Me.BindGrid()
End Sub
Thank you in advance
|
|
|
|
|
Is this homework?
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
|
Thank you very much Richard, as always.
You can see that I am actually using parametized query but commented it out just to get the code to work first before using it again.
|
|
|
|