|
ASP.NET won't maintain viewstate for dynamically created controls. Dynamic controls has to be created on each request. Best place to create dynamic controls is OnInit method.
Alternatively, you can put the textbox in a template column in a gridview/datagrid. When the button is clicked, add a new row to the gridview's datasource and rebind the grid. So the newly added row will have the texbox and it's details will be kept in viewstate by ASP.NET along with the parent control (gridview).
|
|
|
|
|
i m trying to select ,update,insert,delete data using detailsview control. i get error: too many parameters for proc or func..
the params in the sqldatasource are exactly the same as those on the stored proc (6)
|
|
|
|
|
i want to know the complete code of session in ASP.Net.Actually i have to transfer a huge data from one page to another in my site.I will be thank full to u people
|
|
|
|
|
bsse wrote: want to know the complete code of session in ASP.Net
Please elaborate a bit more clearly. Do you mean session variables and that type of thing?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
bsse wrote: i want to know the complete code of session in ASP.Net.
Using session is trivial.
Session["Key"] = YourObject;
YourObject = (YourObject)Session["Key"]; Session will have a unique id called SessionId which will be sent along with the request to determine where to look for session data.
bsse wrote: i have to transfer a huge data from one page to another in my site
Keeping huge data in sessions should be avoided. Session variables are kept on server and your server will die when huge data is set on session. You can update the data to a database table and access it from the other page instead.
|
|
|
|
|
hi all,
i am not able to update the database using gridview.
the code which i written is mentioned below
protected void Row_Updating(object sender, GridViewUpdateEventArgs e)
{
// Label lblId = (Label)CustomerGrid.Rows[e.RowIndex].FindControl("lblContactName");
TextBox txtName = (TextBox)CustomerGrid.Rows[e.RowIndex].FindControl("txtContactName");
TextBox CompanyName = (TextBox)CustomerGrid.Rows[e.RowIndex].FindControl("txtCompanyName");
TextBox Designation = (TextBox)CustomerGrid.Rows[e.RowIndex].FindControl("txtDesignation");
//CustomerGrid.EditIndex = -1;
string myQuery = "UPDATE [customer] SET [Contactname]=@Contactname ,[CompanyName]= @companyName,[Designation] = @Desgination where [CompanyName]= @companyName";
string dataBaseConnection = "Data Source=DAYAKAR\\sqlexpress; Initial Catalog=hospital;Integrated Security=true";
SqlConnection updateCon = new SqlConnection(dataBaseConnection);
SqlCommand updateCommand = new SqlCommand(myQuery, updateCon);
//updateCommand.Parameters.Add(new SqlParameter("@Contactname", SqlDbType.VarChar, 50));
//updateCommand.Parameters["@Contactname"].Value = txtName.Text;
updateCommand.Parameters.AddWithValue("Contactname", txtName.Text);
updateCommand.Parameters.AddWithValue("CompanyName", CompanyName.Text);
updateCommand.Parameters.AddWithValue("Designation", Designation.Text);
SqlDataAdapter updateDA = new SqlDataAdapter(updateCommand);
//CustomerGrid.EditIndex = -1;
string sqlStatement = "Select * from customer";
SqlConnection con = new SqlConnection(dataBaseConnection);
SqlCommand myCommand = new SqlCommand(sqlStatement, con);
SqlDataAdapter da = new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
da.Fill(ds,"customer");
if (ds.Tables.Count > 0)
{
CustomerGrid.DataSource = ds;
CustomerGrid.DataBind();
}
}
}
by using above mentioned code i am not able to update the db.
can anybody help regarding this.
Thanks and Regards
Dayakar D.N
|
|
|
|
|
DayaKar:
What do you meant by not able to update? Are you getting any error? Have you stepped into the code?
|
|
|
|
|
Please when I display my report using the crystal report embedded with visual studio it displays my report at first click but if I click the back button and run the report again I receive a blank page.
Can someone help out on this. here is a sample code of how I load the report Or is there a better way of loading and displaying my reports
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
BindReport()
Catch ex As Exception
End Try
End Sub
Sub BindReport()
s3 = Session("rptDocName")
s2 = Session("QryStr")
s = Session("srcTable")
Try
Dim myConnection As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("LocalSqlServer").ToString)
Dim MyCommand As New SqlCommand()
MyCommand.CommandType = CommandType.Text
Dim MyDA As New SqlDataAdapter(s2, myConnection)
Dim myDS As New DataSet1()
MyDA.Fill(myDS, s)
Dim rdoc As New ReportDocument
rdoc.Load(Server.MapPath("rpt/" & s3 & ".rpt"))
rdoc.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = rdoc
CrystalReportViewer1.DataBind()
Catch ex As Exception
End Try
End Sub
SPC Nigeria
Thanks.
|
|
|
|
|
How do I implement this new effect of displaying the application icon with the url and also with the page title the explorer tab
thanks
SPC Nigeria
Thanks.
|
|
|
|
|
Its far from new
google: favicon.ico
|
|
|
|
|
Put this between the HEAD tags somewhere:
<link rel="icon" href="[icon URL]">
Regards,
--Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year." -Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer." -Fred Brooks
|
|
|
|
|
My site has a login page. After the user logs in he can click the logout button to logout and go back to the login page. If the user does this he can easily click the browser back button to get back into the site. How can I prevent this from happening?
|
|
|
|
|
Build your site so that it doesnt matter if they click the back button.
|
|
|
|
|
When they click the back button after logging out they can see information that is left over in the browser cache from when they were logged in. How can I prevent this from happening?
|
|
|
|
|
Set no-cache but it is still up to the given browser to determine how best to do it and they may ignore your settings.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
i have in a usercontrol drpdwnlst, hyplnk, textbox and label
drpdwnlst and hplnk do not keep their values on postback the rest do
i have the usercontrol added dynamically to placeholder. all code ajaxed
|
|
|
|
|
Hi,
I have developed a web application in .net 2.0 using Word 2007, wherein I am converting a word document into a PDF file. I want to set the dcom setting in Identity tab as "Launching User" and do not want to use "Interactive User" & "This User", since client wont allow for these. I even dont want to give a Domain\Username & password in web.config file under Identity section.(Impersonation)(same reason, since Client wont allow).
When I set Identity user ( in dcom settings for word application) & access from the client machine using other username/password (other than what I have logged in on the server), I dont get any error but nothing happens even & it doesnot convert into pdf. I have also set the IIS properties for Integrated windows Authentication & unchecked the Anonymous Access checkbox.
Any solution, will be highly appreciated.
Thanks in advance
Ajay Mayekar
|
|
|
|
|
Hi,
I have a solution and in this solution are a couple of projects, and a web project. In the web project's bin folder there is a reference to one of the projects, so if the project compiles then this referenced prohect's .dll is added to the bin folder. How do I totally remove this reference? I deleted it from the bin folder, but when I compile the solution then the dll is added again.
Please can some one help.
Thanks
Brendan
|
|
|
|
|
No, the references are not in the bin folder.
In the Solution Explorer in Visual Studio you have a node named References in your project. That is where you can delete the reference.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Right Click the website take PropertyPages.There you'll find References and from that remove the project you want to delete from reference.
|
|
|
|
|
Still coming back. I have deleted several times from property pages. But after compilation it is coming back..
|
|
|
|
|
Hi all,
I have a page where i have a gridview with two buttons which open up two pop ups:
<asp:GridView ID="All_Orders_Grid" runat="server" AutoGenerateColumns="False" AllowSorting="True">
<Columns>
<asp:BoundField DataField="Order_no" HeaderText="Order No" SortExpression="Order_no" />
<asp:BoundField DataField="PARTY_Name" HeaderText="Party" SortExpression="PARTY_Name" />
<asp:BoundField DataField="Order_Date" DataFormatString="{0 :dd/MM/yyyy}" HeaderText="Order Date" HtmlEncode="False" SortExpression="Order_Date" />
<asp:BoundField DataField="Order_Deliv_Date" DataFormatString="{0 :dd/MM/yyyy}" HeaderText="Delivery Date" HtmlEncode="false" SortExpression="Order_Deliv_Date" />
<asp:BoundField DataField="supplier_loc" HeaderText="Supplier Location" SortExpression="supplier_loc" />
<asp:BoundField DataField="bill_loc" HeaderText="Billing Location" SortExpression="bill_loc" />
<asp:BoundField DataField="Order_Value" HeaderText="Ordered Amount" DataFormatString="{0 :#,###,###.00}" SortExpression="Order_Value" />
<asp:TemplateField HeaderText="Cash Advance">
<ItemTemplate>
#
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Option">
<ItemTemplate>
<table style="width: 100%; height: 100%">
<tr>
<td>
<a runat="server" id="lnk_Add">
<INPUT type="button" ID="Button_Add_Items" value="Add Items" /></a></td>
<td>
<a runat="server" id="Lnk_Edit">
<INPUT ID="Button_Edit_Qty" type="button" value="Edit Qty" /></a></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Order_no" HeaderText="Order No" SortExpression="Order_no" />
</Columns>
<RowStyle CssClass="datagrid_row1" />
<HeaderStyle CssClass="datagrid_heading" />
</asp:GridView>
</pre>
In the row datat bound event i wrote:
<pre>Dim btn1lnl As HtmlAnchor = CType(e.Row.FindControl("lnk_Add"), HtmlAnchor)
Dim btn1ln2 As HtmlAnchor = CType(e.Row.FindControl("Lnk_Edit"), HtmlAnchor)
btn1lnl.Attributes.Add("onclick", "return Open_Window(1,'" + e.Row.Cells(9).Text + "')")
btn1ln2.Attributes.Add("onclick", "return Open_Window(2,'" + e.Row.Cells(9).Text + "')")
the javascript i used to open the pop ups is
function Open_Window(option,orderno)
{
if(option==2)
{
var w=window.open('Edit_Order.aspx?ID='+orderno+'&&option=1')
return false;
}
else
{
var w= window.open('Add_OrderItems.aspx?ID='+orderno);
return false;
}
}
When i save the data in the child window i want to refresh the parent page which contains the Gridview. For this purpose i wrote the foll function in the code
<pre>Sub Show_Msg()
Dim scp As String = "<script type='text/javascript'>alert('Data Saved Successfully');CloseAndReload();</script>"
ClientScript.RegisterClientScriptBlock(Me.GetType(), "script1", scp)
End Sub</pre>
and the script use is :
<pre> function CloseAndReload()
{
window.close();
if (window.opener && !window.opener.closed)
{
window.opener.location.reload();
}
}</pre>
the problem i m facing is that this script works on my local host, but when i deployed it to the server, it gives me a message
"This page cannot be refreshed without resending information, Click
retry to send the information again ..."
if i click yes the pop up opens again and the user thinks the data was not saved.If i click no the page is not refreshed and again the user thinks the data was not saved.
Any solutions.......
When you fail to plan, you are planning to fail.
|
|
|
|
|
did u used Ajax in the parent/child page
Cheers!!
Brij
|
|
|
|
|
yes,
But its only the calendar extender control.
Its working well in local, but fails on the server.
When you fail to plan, you are planning to fail.
|
|
|
|
|
Register the script with ScriptManager as
ScriptManager.RegisterClientScriptBlock(Me.GetType(), "script1", scp)
Cheers!!
Brij
|
|
|
|