|
What is the issue in using UpdatePanel ? If you say you are using ScriptManager, then your project is AJAX enabled. So you can use UpdataPanel without any issues, isn't it ?
|
|
|
|
|
hi
this is my code and i m here at my compny restrict to use update panel.
so now suggest me how to solve it
thanks
This is my Aspx page
]]>
<title>Untitled Page
function ShowSaveButton()
{
var divNormStyle = document.getElementById("divNormal").style;
var divPopStyle = document.getElementById("divPopulate").style;
divNormStyle.visibility = 'hidden';
divNormStyle.display = 'none';
divPopStyle.visibility = 'visible';
divPopStyle.display = 'block';
}
function HideSaveButton()
{
var divNormStyle = document.getElementById("divNormal").style;
var divPopStyle = document.getElementById("divPopulate").style;
divPopStyle.visibility = 'hidden';
divPopStyle.display = 'none';
divNormStyle.visibility = 'visible';
divNormStyle.display = 'block';
}
<asp:button id="btnPopulateGrid" runat="server">
Text="PopulateGrid"
ValidationGroup="vgNumberOfRows" OnClick="btnPopulateGrid_Click" />
|
<asp:button id="btnSaveGrid" runat="server">
Text="Save Grid" OnClick="btnSaveGrid_Click" />
|
| <asp:gridview id="gvwDynamicRows" runat="server">
AutoGenerateColumns="false"
Width="100%">
<columns> <asp:templatefield>
<headertemplate>
<asp:label id="lblimg" runat="server">
Text=" ">
<itemtemplate>
<asp:imagebutton id="btnPopulateGrid" runat="server">
ImageUrl="add.gif" ToolTip="Add Row" OnClick="btnPopulateGrid_Click"/>
<asp:templatefield>
<headertemplate>
<asp:label id="Label1" runat="server">
Text="Name">
<itemtemplate>
<asp:textbox id="TextBox1" runat="server">
Text='<%# Eval("Name")%>'
Width ="100px">
<asp:templatefield>
<headertemplate>
<asp:label id="Label2" runat="server">
Text="ContactNo">
<itemtemplate>
<asp:textbox id="TextBox2" runat="server">
Text='<%# Eval("contactNo")%>'
Width ="100px">
<asp:templatefield>
<headertemplate>
<asp:label id="Label3" runat="server">
Text="Email">
<itemtemplate>
<asp:textbox id="TextBox3" runat="server">
Text='<%# Eval("email")%>'
Width ="100px">
<asp:templatefield>
<headertemplate>
<asp:label id="Label4" runat="server">
Text="Designation">
<itemtemplate>
<asp:textbox id="TextBox4" runat="server">
Text='<%# Eval("designation")%>'
Width ="100px">
|
<asp:validationsummary id="vsNumberOfRows" runat="server">
ShowMessageBox="true"
ShowSummary="false"
ValidationGroup="vgNumberOfRows"/>
This is aspx.cs page
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySql.Data.MySqlClient;
public partial class _Default : System.Web.UI.Page
{
private DataTable dt;
DataRow dr;
string cScript;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
dt = CreateDataTable();
Session["dtadd"] = dt;
btnPopulateGrid_Click(this.GetType(), null);
}
}
protected void btnPopulateGrid_Click(object sender, EventArgs e)
{
dt = (DataTable)Session["dtadd"];
dr = dt.NewRow();
dt.Rows.Add(dr);
gvwDynamicRows.DataSource = dt;
gvwDynamicRows.DataBind();
cScript = "ShowSaveButton();";
ClientScript.RegisterStartupScript(typeof(Page), "clientscript", cScript);
Session["dtadd"] = dt;
}
protected DataTable CreateDataTable()
{
DataTable dtValues = new DataTable();
dtValues.Columns.Add(" ");
dtValues.Columns.Add("Name");
dtValues.Columns.Add("contactNo");
dtValues.Columns.Add("email");
dtValues.Columns.Add("designation");
return dtValues;
}
protected void btnSaveGrid_Click(object sender, EventArgs e)
{
string cmdText;
foreach (GridViewRow gdr in gvwDynamicRows.Rows)
{
string name = ((TextBox)gdr.FindControl("TextBox1")).Text;
string contactNo = ((TextBox)gdr.FindControl("TextBox2")).Text;
string email = ((TextBox)gdr.FindControl("TextBox3")).Text;
string designation = ((TextBox)gdr.FindControl("TextBox4")).Text;
string mycon = "Database=tsmdemo;Server=192.168.2.22;uid=root;pwd=tops123;";
using (MySqlConnection connection = new MySqlConnection(mycon))
{
connection.Open();
cmdText = "INSERT INTO tblempinfo VALUES ('"
+ name + "','" + contactNo + "','" + email + "','" + designation + "')";
MySqlCommand cmd = new MySqlCommand(cmdText, connection);
cmd.ExecuteNonQuery();
}
}
gvwDynamicRows.DataBind();
cScript = "HideSaveButton();";
ClientScript.RegisterStartupScript(typeof(Page), "clientscript", cScript);
}
}
|
|
|
|
|
Hi,
I am using SQLDatasource to fill the grid. Table that is use to display in grid not having primary key. Now I want to delete the records without using RowDeleting Option. Because table does not contains primary key.
So What Should I do ?
Thanks
|
|
|
|
|
I would try and put a primary key on the table, if this is not possible create a stored procedure where you pass through the information to enable you to find the row you wish to delete.
i.e Table with two columns Description, IPAddress
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create PROCEDURE Canteen_DeleteLocation
-- Add the parameters for the stored procedure here
@Description varchar(20),
@IPAddress varchar(15)
AS
BEGIN
DELETE FROM [Canteen_Location]
WHERE Description = @Description And IPAddress = @IPAddress
END
GO
Then you just need to setup the datasource delete parameter to call this SP and ensure your fields are databound.
Hope this helps?
Tom
|
|
|
|
|
Its usually good practice to have a primary key for your tables, I would def put one in
|
|
|
|
|
Hi
I have created a website which has a number of buttons on it which allow users to add items to there basket, they then click on an AJAX watermarked textbox to set focus before using a keyboard wedge scanner to scan there staff ID card, this causes a postback and validates the user - all works perfectly. - This is all done on a touch screen with a keyboard wedge scanner, the users will have no access to a keyboard.
My problem is caused if the user attempts to scan their card before clicking on the watermarked textbox. This then forces a postback to the server and will fire one of the button controls at random (I presume it fires a control which it thinks has got the focus.)
I have tried setting focus to a textbox automatically following a button control being fired this would then ensure that the wrong button is not fire if the user accidentally scans before they set focus of the control. however the cursor only appears in the text box on original page load and not after the control has been updated.
textbox1.focus
updatepanel2.focus
Any body got any suggestions on this???? Is there a way that I can tell how the postback has been fired and therefore being able to trap it? The barcode value is 'pu00000343'
Thanks
Tom
|
|
|
|
|
Hi, i have one grid view which having one template column. In that item template contains linkbutton and edit template contains fileupload control.
When i am adding new row to gridview, the fileupload control will appear and i will upload the file. Up to this its working fine. But when i am in edit mode, i want to display the file name in fileupload control. But being its read only property, its not showing the filename in upload control and when it is submitting, the null value is entering in database.?
How can i show the filename or filepath in fileupload control, when gridview is in edit mode.
G. Satish
|
|
|
|
|
Satish - Developer wrote: fileupload control, when gridview is in edit mode.
Fileupload control don't have any constraints with gridview. It will be rendered as HTML upload control which don't allow to set the file path through code.
|
|
|
|
|
Some nasty javascript might do the trick. Use Attributes.Add("value", yourUrlString) in your codebehind.
I did this once for a password field:
txtPassword.Attributes.Add("value", readUserDetail["password"].ToString());
|
|
|
|
|
Hi,
I have a web service client app and I am trying to monitor the soap
traffic to and from my service with a tool called SoapUI.
The tool allows me too either create a TCP tunnel or a HTTP proxy.
So I am not sure which one I should use.
If we use the tunnel it has the web service url and a port to assign values
which I have done. https://www.mydomain.com/myservice.asmx port 8089.
But now how do I point my webservice client proxy to the SoapUI tunnel.
I tried this
https://localhost/myservice.asmx:8089
Does not work i get Connection was interrupted error.
Malcolm
|
|
|
|
|
I have a asp gridview named "gridview1" with three columns. The first column is
named "description" , second column "price", and the third "quantity". I
have added a template column to the gridview1 named "Total" and placed a text
box named "RowTotal" in the column.
Question-
How can I have the gridview multiply "price" by "quantity" and place the
result in the textbox "RowTotal" when the user selects the quantity amount
they want in the "quantity" column?
Thanks in advance for the help
|
|
|
|
|
In Quantity Column whether you having textbox or dropdownlist control.
|
|
|
|
|
And also tell the name of the primary key of your table,so that it will be helpful for us
|
|
|
|
|
In the OnRowDataBound eventhandler of a gridview you can check the values for price and quantity. Multiply them and show the value in your TextBox-object.
There are numerous examples to be found via codeproject.com or google.
|
|
|
|
|
Hi,
One way to do this by making all the columns in the grid as template columns.
then in the RowDataBound event using FindControl() method, set the value for Total label.
<br />
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem )<br />
{<br />
decimal Price = Convert.ToDecimal ( ((Label)e.Item.FindControl("PriceLabel")).Text );<br />
decimal Quantity = Convert.ToDecimal ( ((Label)e.Item.FindControl("QuantityLabel")).Text );<br />
Label TotalLabel = ((Label)e.Item.FindControl("TotalLabel"));<br />
TotalLabel.Text = Convert.ToString ( Price * Quantity);<br />
}<br />
<br />
Where did error begin?
-- Naison Garvasis Pekkattil
|
|
|
|
|
Could you help me with a VB example? The "Price" column is a money type in the database and the "Quantity" column is an int type in the database. Here is the code.
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
Dim TotalLabel As String
Dim Quantity As String
Dim Price As String
If e.Row.RowType = ListItemType.Item Or e.Row.RowType = ListItemType.AlternatingItem Then
End If
Decimal Price = Convert.ToDecimal ( ((Items)e.Item.FindControl("PriceLabel")).Text );
Decimal Quantity = Convert.ToDecimal ( ((Items)e.Item.FindControl("Quantity")).Text );
Decimal TotalLabel = ((Items)e.Item.FindControl("TotalLabel"));
TotalLabel = Convert.ToString(Price * Quantity)
End Sub
Thank you
|
|
|
|
|
Hi again...
I just wanna adjust location of a control like textbox whatever located on asp.net page and i wanna make it by using c# code at code-behind...
thanks in advance...
I am not a perfect programmer,but i have perfect's programmers' habits.
|
|
|
|
|
I suggest you buy a book on ASP.NET and read it. A book on HTML is an even better idea. Your server side controls, build HTML, that's how they work. You can use css to give a control an absolute position, but I would always avoid that, the flow model of HTML works well for browsers that can be resized or on different size screens.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi..
I don't know if you've ever used Gmail Upload type but I just wanna use that type upload. Ok let me tell you what i want There must be a button and when users want to add more than one file at the same time then they can just click on that button to add a new fileupload control without no page refresh and when clicking on Upload button all browsed and selected file is gonne go how can I do that ? how kind javascript code i have to use and the other processes.
Thanks in advance...
I am not a perfect programmer,but i have perfect's programmers' habits.
|
|
|
|
|
There are numerous commercial controls that do this, or you can use javascript to write your own.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Actually yeah I knew I should write my own codes but the problem is how i can do that ? Do you know any article or source code for that. It'd be so appreciated...
thanks.
I am not a perfect programmer,but i have perfect's programmers' habits.
|
|
|
|
|
The beauty of web programming is that any site that does what you want on the client side, sends you the code. The issue, from memory, is getting the controls on the server side so you can access the file data posted. I think I ended up adding a finite number of controls and show/hiding them with javascript, instead of just dynamically adding them with script.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have a major application with a few sub-applications.
One of my subfolder contains some utilities objects; that subdirectory is also inside my sub application.After conversion to 2.0 my main utility object(from the main app.) is ignoring the properties and methods that I have newly created so is the sub utility object...
Is legal to have the same folder in the main and the sub apps.?
|
|
|
|
|
Just a quick question, is the ASP.NET textbox control only capable of displaying pure text?
Is there anyway to embed a HTML link inside the textbox? Thanks!
If not, is there anything else I can use? Thanks!!!
|
|
|
|
|
Infernojericho wrote: Just a quick question, is the ASP.NET textbox control only capable of displaying pure text?
Yes. The TextBox control renders to a HTML INPUT tag which can only display unformatted text.
Infernojericho wrote: Is there anyway to embed a HTML link inside the textbox?
You could create a 'fake' textbox using a DIV tag with the contenteditable=true attribute. Not something I've really tried to do myself, but search Google and you should find some more information.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|