|
Thanks,I understand now... Chris,you are a good 'teacher'.
|
|
|
|
|
Hi! Is there an example on how I can hover the mouse over listbox item (image names) and show the image? Thanks!....Also my images are from Database...
|
|
|
|
|
Try this[^]
Be careful, there is no Undo Button(Ctrl+Z) in life.
|
|
|
|
|
Hi folks,
I have add a dropdownlist into my datagridview. This dropdown list consists two unbound value (item1= 'YES' and item2= 'NO')
How can I update my datagridview data by using update button. Any idea?
error message is:
"DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items"
|
|
|
|
|
Try to create a list of items, hard coded ( just a List<string> will do ), and then bind to that.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks for your reply..
I have added the following code and no change occured:
<asp:TemplateField HeaderText="EAN" SortExpression="EAN">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" DataTextField="EAN" DataValueField="EAN" >
<asp:ListItem Text="YES" Value="YES" />
<asp:ListItem Text="NO" Value="NO" />
</asp:DropDownList>
</EditItemTemplate>
|
|
|
|
|
Hello,
Thank you for your reply. I have added the following code but nothing changed:
<asp:TemplateField HeaderText="EAN" SortExpression="EAN">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" DataTextField="EAN" DataValueField="EAN" >
<asp:ListItem Text="YES" Value="YES" />
<asp:ListItem Text="NO" Value="NO" />
</asp:DropDownList>
</EditItemTemplate>
|
|
|
|
|
Hello,
I have declared an image control. I'm trying to display a picture from my db using linq.
The code:
protected void Button1_Click(object sender, EventArgs e)
{
DataClassesDataContext db = new DataClassesDataContext();
test1 x2 = db.test1s.First(p => p.descriere.StartsWith("xxx"));
byte[] img = (x2.img);
MemoryStream ms = new MemoryStream(img);
System.Drawing.Image Image1 = System.Drawing.Image.FromStream(ms);
}
where test1 is a table with 3 fields- id-int/descriere char/img image. Do i need more code for the picture to show? or what is the problem?
|
|
|
|
|
You're using LINQ, but you don't know how a website displays images ?
You need to provide a URL to an image, or a URL to a page that streams back these bytes. I don't see any code here that even attempts to display your image.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
can you, please, show me -in code- how can i display the picture from the byte[]: img?
test1 x2 = db.test1s.First(p => p.descriere.StartsWith("xxx"));
byte[] img = (x2.img);
|
|
|
|
|
|
the code so far is:
protected void Button1_Click(object sender, EventArgs e)
{
DataClassesDataContext db = new DataClassesDataContext();
test1 x2 = db.test1s.First(p => p.descriere.StartsWith(" Firma bazata pe intuitia cumparatorulu"));
byte[] img = (x2.img);
MemoryStream ms = new MemoryStream(img);
System.Drawing.Image Image1 = System.Drawing.Image.FromStream(ms);
MemoryStream stream = new MemoryStream;
Image1.Save(stream,ImageFormat.Jpeg);
Bitmap b = new Bitmap(Image1.Width, Image1.Height);
Graphics g = new Graphics.FromImage(b);
}
my error: 'System.Drawing.Graphics.FromImage(System.Drawing.Image)' is a 'method' but is used like a 'type'.
Can someone tell me what why or show me the right code?
|
|
|
|
|
when i try & get my "objdscolleaguedetails could no tfind a non-generic method 'updcolleaguedetails' that has parametera: strconn, colleaguename, mobile, extension, colleagueid.
I've set the gridview's datakeynames to colleagueid,colleaguename,mobile,extension.
I've set my control parameters to update the three fields.
I just cannot figure out why it does not work.
<pre>Web methods
<webservice(namespace:> _
<webservicebinding(conformsto:> _
<global.microsoft.vi></global.microsoft.vi> sualBasic.CompilerServices.DesignerGenerated()> _
Public Class WAB_DataAccessWS
Inherits System.Web.Services.WebService
<webmethod()> _
Public Function GenericQuery(ByVal strConn As String, ByVal strQuery As String) As DataSet
Return WAB_DataAccess.GenericQuery(strConn, strQuery)
End Function
'Select method
<webmethod()> _
Public Function selColleagueDetails(ByVal strConn As String, ByVal intDepartmentID As Integer) As DataSet
Return WAB_DataAccess.selaColleagueDetails(strConn, intDepartmentID)
End Function
'Update method
<webmethod()> _
Public Function updColleagueDetails(ByVal strConn As String, ByVal intColleagueID As Integer, ByVal strColleagueName AS String, ByVal strMobile As String, ByVal strExtension As String) As Integer
Return WAB_DataAccess.UpdaColleagueDetails(strConn, intColleagueID, strColleagueName, strMobile,strExtension)
End Function
End Class
Class
Public Class WAB_DataAccess
Inherits DataAccessBase_v2
' this will be deprecated
Public Shared Function GenericQuery(ByVal strConn As String, ByVal strQuery As String) As DataSet
Return ExecuteQuery_ds(strConn, strQuery)
End Function
'select method called from the webservice
Public Shared Function selaColleagueDetails(ByVal strConn As String, ByVal intDepartmentID As Integer) As DataSet
Return ExecuteQuery_ds(strConn, "exec p_ColleagueDetails " & CStr(intDepartmentID))
End Function
Public Shared Function UpdaColleagueDetails(ByVal strConn As String, ByVal intColleagueID As Integer, ByVal strColleagueName AS String, ByVal strMobile As String, ByVal strExtension As String) As Integer
Dim conn As SqlConnection = New SqlConnection(strConn)
Dim cmd As SqlCommand = New SqlCommand("exec p_UpdateColleaguesDetails '" & intColleagueID & "', '" & strColleagueName & "', " & strMobile & ", '" & strExtension & "'", conn)
Dim result As Integer = 0
conn.Open()
result = cmd.ExecuteNonQuery()
conn.Close()
Return result
End Function
End Class
]]>
]]>
<asp:content id="topContent" contentplaceholderid="topContent" runat="Server" xmlns:asp="#unknown">
<asp:hiddenfield id="hdnMainConnStr" runat="server">
<asp:hiddenfield id="hdnQueryDepartmentDetails" runat="server">
<asp:hiddenfield id="hdnQueryColleagueDetails" runat="server">
<%--use this hiddenfield to update the values of the datagrid with new colleague details--%>
<asp:hiddenfield id="hdnUpdateColleagues" runat="server">
<%--use this hiddenfield to update the values of the datagrid with new colleague details--%>
<asp:hiddenfield id="hdnParamDeleteColleagues" runat="server">
<asp:hiddenfield id="hdnQueryAddColleague" runat="server">
<asp:label id="lblMsg" runat="server" cssclass="" enableviewstate="false">Please Select Your Department |
<asp:dropdownlist id="ddlDepartment" runat="server" cssclass="" datasourceid="objDepartmentDetails" datatextfield="DepartmentName" datavaluefield="DepartmentID" autopostback="true">
<asp:objectdatasource id="objDepartmentDetails" runat="server" selectmethod="GenericQuery" typename="WAB_DataAccessWS.WAB_DataAccessWS">
<selectparameters>
<asp:controlparameter controlid="hdnMainConnStr" name="strConn" propertyname="Value" type="String">
<asp:parameter defaultvalue="exec p_DepartmentDetails" name="strQuery" type="String">
|
Rows per page:
<asp:textbox id="txtRowsPerPage" runat="server" cssclass="" autopostback="true" columns="4" maxlength="4" tabindex="5">
(<%=intMinRows%>-<%=intMaxRows%>)
|
<asp:gridview id="gvwColleagueDetails" runat="server" emptydatatext="No colleague records were found.">
datasourceid="objdsColleagueDetails" cellpadding="4" gridlines="None"
width="100%" allowsorting="True" allowpaging="True"
autogeneratecolumns="False" ForeColor="#333333" ShowFooter="True" DataKeyNames="ColleagueID,ColleagueName,Mobile,Extension">
<pagersettings position="Top">
<pagerstyle horizontalalign="Center" backcolor="#284775" forecolor="White">
<footerstyle backcolor="#5D7B9D" font-bold="True" forecolor="White">
<headerstyle backcolor="#5D7B9D" font-bold="True" forecolor="White">
<editrowstyle backcolor="#999999">
<alternatingrowstyle backcolor="White" forecolor="#284775">
<selectedrowstyle forecolor="#CCFF99" font-bold="True">
BackColor="#009999">
<rowstyle forecolor="#003399" backcolor="White">
<columns> <asp:commandfield showeditbutton="True" showdeletebutton="True" deletetext="Remove" headertext="Add Remove Collegaue">
<asp:boundfield headertext="ColleagueID" readonly="True" datafield="ColleagueID" sortexpression="ColleagueID">
<asp:templatefield headertext="ColleagueName" sortexpression="ColleagueName">
<edititemtemplate>
<asp:textbox id="txtColleagueName" runat="server" text="<%# Bind(" colleaguename")="" %>"="">
<itemtemplate>
<asp:label id="lblColleagueName" runat="server" text="<%# Eval(" colleaguename")="" %>"="">
<asp:templatefield headertext="Mobile" sortexpression="Mobile">
<edititemtemplate>
<asp:textbox id="txtMobile" runat="server" text="<%# Bind(" mobile")="" %>"="">
<itemtemplate>
<asp:label id="lblMobile" runat="server" text="<%# Eval(" mobile")="" %>"="">
<asp:templatefield headertext="Extension" sortexpression="Extension">
<edititemtemplate>
<asp:textbox id="txtExtension" runat="server" text="<%# Bind(" extension")="" %>"="">
<itemtemplate>
<asp:label id="lblExtension" runat="server" text="<%# Eval(" extension")="" %>"="">
<%--<asp:objectdatasource id="objdsColleagueDetails" runat="server" selectmethod="GenericQuery" updatemethod="hdnUpdateColleagues" typename="WAB_DataAccessWS.WAB_DataAccessWS">--%>
<asp:objectdatasource id="objdsColleagueDetails" runat="server" typename="WAB_DataAccessWS.WAB_DataAccessWS" selectmethod="selColleagueDetails" updatemethod="updColleagueDetails">
<selectparameters>
<asp:controlparameter controlid="hdnMainConnStr" name="strConn" propertyname="Value" type="String">
<asp:controlparameter controlid="ddlDepartment" name="intDepartmentID" propertyname="SelectedValue" type="Int32">
<updateparameters>
<asp:controlparameter controlid="hdnMainConnStr" defaultvalue="" name="strConn" propertyname="Value" type="String">
<asp:parameter name="ColleagueName" type="String">
<asp:parameter name="Mobile" type="String">
<asp:parameter name="Extension" type="String">
|
<asp:label id="Label1" runat="server" cssclass="" enableviewstate="false">Add Colleague Details
|
<asp:dropdownlist id="ddlAddColleague" runat="server" cssclass="" datasourceid="objdsAddColleague" datavaluefield="ColleagueName" autopostback="true">
<asp:objectdatasource id="objdsAddColleague" runat="server" selectmethod="GenericQuery" typename="WAB_DataAccessWS.WAB_DataAccessWS">
<selectparameters>
<asp:controlparameter controlid="hdnMainConnStr" name="strConn" propertyname="Value" type="String">
<asp:parameter defaultvalue="exec p_AddColleague" name="strQuery" type="String">
| <asp:button id="btnAdd" cssclass="" runat="server" text="Add Colleague" tooltip="Add Colleague" onclientclick="return confirmAction('Are you sure you want to Add Colleague"> |
thanks for your help
|
|
|
|
|
when i try & get my "objdscolleaguedetails could no tfind a non-generic method 'updcolleaguedetails' that has parametera: strconn, colleaguename, mobile, extension, colleagueid.
I've set the gridview's datakeynames to colleagueid,colleaguename,mobile,extension.
I've set my control parameters to update the three fields.
I just cannot figure out why it does not work.
Web methods
<webservice(namespace:> _
<webservicebinding(conformsto:> _
<global.microsoft.visualbasic.compilerservices.designergenerated()> _
Public Class WAB_DataAccessWS
Inherits System.Web.Services.WebService
<webmethod()> _
Public Function GenericQuery(ByVal strConn As String, ByVal strQuery As String) As DataSet
Return WAB_DataAccess.GenericQuery(strConn, strQuery)
End Function
'Select method
<webmethod()> _
Public Function selColleagueDetails(ByVal strConn As String, ByVal intDepartmentID As Integer) As DataSet
Return WAB_DataAccess.selaColleagueDetails(strConn, intDepartmentID)
End Function
'Update method
<webmethod()> _
Public Function updColleagueDetails(ByVal strConn As String, ByVal intColleagueID As Integer, ByVal strColleagueName AS String, ByVal strMobile As String, ByVal strExtension As String) As Integer
Return WAB_DataAccess.UpdaColleagueDetails(strConn, intColleagueID, strColleagueName, strMobile,strExtension)
End Function
End Class
Class
Public Class WAB_DataAccess
Inherits DataAccessBase_v2
' this will be deprecated
Public Shared Function GenericQuery(ByVal strConn As String, ByVal strQuery As String) As DataSet
Return ExecuteQuery_ds(strConn, strQuery)
End Function
'select method called from the webservice
Public Shared Function selaColleagueDetails(ByVal strConn As String, ByVal intDepartmentID As Integer) As DataSet
Return ExecuteQuery_ds(strConn, "exec p_ColleagueDetails " & CStr(intDepartmentID))
End Function
Public Shared Function UpdaColleagueDetails(ByVal strConn As String, ByVal intColleagueID As Integer, ByVal strColleagueName AS String, ByVal strMobile As String, ByVal strExtension As String) As Integer
Dim conn As SqlConnection = New SqlConnection(strConn)
Dim cmd As SqlCommand = New SqlCommand("exec p_UpdateColleaguesDetails '" & intColleagueID & "', '" & strColleagueName & "', " & strMobile & ", '" & strExtension & "'", conn)
Dim result As Integer = 0
conn.Open()
result = cmd.ExecuteNonQuery()
conn.Close()
Return result
End Function
End Class
]]>
]]>
<asp:content id="topContent" contentplaceholderid="topContent" runat="Server" xmlns:asp="#unknown">
<asp:hiddenfield id="hdnMainConnStr" runat="server">
<asp:hiddenfield id="hdnQueryDepartmentDetails" runat="server">
<asp:hiddenfield id="hdnQueryColleagueDetails" runat="server">
<%--use this hiddenfield to update the values of the datagrid with new colleague details--%>
<asp:hiddenfield id="hdnUpdateColleagues" runat="server">
<%--use this hiddenfield to update the values of the datagrid with new colleague details--%>
<asp:hiddenfield id="hdnParamDeleteColleagues" runat="server">
<asp:hiddenfield id="hdnQueryAddColleague" runat="server">
<asp:label id="lblMsg" runat="server" cssclass="" enableviewstate="false">Please Select Your Department |
<asp:dropdownlist id="ddlDepartment" runat="server" cssclass="" datasourceid="objDepartmentDetails" datatextfield="DepartmentName" datavaluefield="DepartmentID" autopostback="true">
<asp:objectdatasource id="objDepartmentDetails" runat="server" selectmethod="GenericQuery" typename="WAB_DataAccessWS.WAB_DataAccessWS">
<selectparameters>
<asp:controlparameter controlid="hdnMainConnStr" name="strConn" propertyname="Value" type="String">
<asp:parameter defaultvalue="exec p_DepartmentDetails" name="strQuery" type="String">
|
Rows per page:
<asp:textbox id="txtRowsPerPage" runat="server" cssclass="" autopostback="true" columns="4" maxlength="4" tabindex="5">
(<%=intMinRows%>-<%=intMaxRows%>)
|
<asp:gridview id="gvwColleagueDetails" runat="server" emptydatatext="No colleague records were found.">
datasourceid="objdsColleagueDetails" cellpadding="4" gridlines="None"
width="100%" allowsorting="True" allowpaging="True"
autogeneratecolumns="False" ForeColor="#333333" ShowFooter="True" DataKeyNames="ColleagueID,ColleagueName,Mobile,Extension">
<pagersettings position="Top">
<pagerstyle horizontalalign="Center" backcolor="#284775" forecolor="White">
<footerstyle backcolor="#5D7B9D" font-bold="True" forecolor="White">
<headerstyle backcolor="#5D7B9D" font-bold="True" forecolor="White">
<editrowstyle backcolor="#999999">
<alternatingrowstyle backcolor="White" forecolor="#284775">
<selectedrowstyle forecolor="#CCFF99" font-bold="True">
BackColor="#009999">
<rowstyle forecolor="#003399" backcolor="White">
<columns> <asp:commandfield showeditbutton="True" showdeletebutton="True" deletetext="Remove" headertext="Add Remove Collegaue">
<asp:boundfield headertext="ColleagueID" readonly="True" datafield="ColleagueID" sortexpression="ColleagueID">
<asp:templatefield headertext="ColleagueName" sortexpression="ColleagueName">
<edititemtemplate>
<asp:textbox id="txtColleagueName" runat="server" text="<%# Bind(" colleaguename")="" %>"="">
<itemtemplate>
<asp:label id="lblColleagueName" runat="server" text="<%# Eval(" colleaguename")="" %>"="">
<asp:templatefield headertext="Mobile" sortexpression="Mobile">
<edititemtemplate>
<asp:textbox id="txtMobile" runat="server" text="<%# Bind(" mobile")="" %>"="">
<itemtemplate>
<asp:label id="lblMobile" runat="server" text="<%# Eval(" mobile")="" %>"="">
<asp:templatefield headertext="Extension" sortexpression="Extension">
<edititemtemplate>
<asp:textbox id="txtExtension" runat="server" text="<%# Bind(" extension")="" %>"="">
<itemtemplate>
<asp:label id="lblExtension" runat="server" text="<%# Eval(" extension")="" %>"="">
<%--<asp:objectdatasource id="objdsColleagueDetails" runat="server" selectmethod="GenericQuery" updatemethod="hdnUpdateColleagues" typename="WAB_DataAccessWS.WAB_DataAccessWS">--%>
<asp:objectdatasource id="objdsColleagueDetails" runat="server" typename="WAB_DataAccessWS.WAB_DataAccessWS" selectmethod="selColleagueDetails" updatemethod="updColleagueDetails">
<selectparameters>
<asp:controlparameter controlid="hdnMainConnStr" name="strConn" propertyname="Value" type="String">
<asp:controlparameter controlid="ddlDepartment" name="intDepartmentID" propertyname="SelectedValue" type="Int32">
<updateparameters>
<asp:controlparameter controlid="hdnMainConnStr" defaultvalue="" name="strConn" propertyname="Value" type="String">
<asp:parameter name="ColleagueName" type="String">
<asp:parameter name="Mobile" type="String">
<asp:parameter name="Extension" type="String">
|
<asp:label id="Label1" runat="server" cssclass="" enableviewstate="false">Add Colleague Details
|
<asp:dropdownlist id="ddlAddColleague" runat="server" cssclass="" datasourceid="objdsAddColleague" datavaluefield="ColleagueName" autopostback="true">
<asp:objectdatasource id="objdsAddColleague" runat="server" selectmethod="GenericQuery" typename="WAB_DataAccessWS.WAB_DataAccessWS">
<selectparameters>
<asp:controlparameter controlid="hdnMainConnStr" name="strConn" propertyname="Value" type="String">
<asp:parameter defaultvalue="exec p_AddColleague" name="strQuery" type="String">
| <asp:button id="btnAdd" cssclass="" runat="server" text="Add Colleague" tooltip="Add Colleague" onclientclick="return confirmAction('Are you sure you want to Add Colleague"> |
thanks for your help
|
|
|
|
|
Hallo,
I have a textbox with onblur event handled with javascript.
I have asp.net button. When i chage the text in textbox and directly click the button, i get a confirm box from the onblur event. How can i make the button event to fire after answering the confirm box.
In other cases like press tab or clicking some other control is not a problem.
example code:
Textbox txt = new TextBox
txt.id = "txt";
txt.attributes.add("onblur","showmsg(this.id)")
Javascript:
function showmsg(id)
{
var x = document.getElementById(id).value;
if (x != "") {
var res = confirm("msg");
if (res == true) {
document.getElementById(id).value = x;
}
else {
document.getElementById(id).value = "";
}
}
}
|
|
|
|
|
document.getelementbyid('yourButtonId').click();
I didn't get any requirements for the signature
|
|
|
|
|
Thanks,
But how to detect that it is button click event after onblur event.
I mean i want to fire the button click event only if the button is pressed immediately after changing text in textbox.
|
|
|
|
|
How come you can not do this the easy way and set the autopostaback of the textbox to true and use the code behind for that event?
I don't have a good answer for you to know if an event occurs immediately after another event. You may have to use a global variable and a javascript timer. I have no idea.
I didn't get any requirements for the signature
|
|
|
|
|
I do not want autopostback on textbox. There should be some way to detect button click event in javascript.
|
|
|
|
|
|
hello
Can any one help me how to work with web parts with sql server 2000.
By default web parts using sql express
|
|
|
|
|
Webparts have nothing to do with your database.
I didn't get any requirements for the signature
|
|
|
|
|
How to trigger postback for a javascript
<br />
<script language="javascript" type="text/javascript"><br />
function Button1_onclick()<br />
{<br />
document.forms[0]['fileBrowse'].click();<br />
document.forms[0]['TextBox1'].value = document.forms[0]['fileBrowse'].value;<br />
__doPostBack( 'TextBox1','');<br />
}<br />
<br />
</script><br />
<br />
<br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<input id="fileBrowse" type="file" style="visibility: hidden" /><br />
<input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /><br />
<input id="TextBox1" type="text" /><br />
</div><br />
</form><br />
</body><br />
this code showing an error "object expected" while debugging javascript
Regards,
Radhakrishnan
|
|
|
|
|
Hi,
i'm not sure, but maybe you have to use
document.getElementById()
and the onclick doesn't seem correct:
onclick="javascript:Button1_onclick();"
Do you get the error on your server or on the client?
Regards
Sebastian
|
|
|
|
|
Error at client side
on that __doPostBack()
|
|
|
|
|