|
i m assignning some text in a text box which is in DetailsView
in Page load event using find control
there is not any error message showing in it but text in a text box which is in DetailsView is not shown
I m giving code what i done
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim txtmachine As TextBox = New TextBox
txtmachine = CType(dvwProduct.FindControl("txtMachineId"), TextBox)
If Request.QueryString("ID") IsNot Nothing Then
txtmachine.Text = Request.QueryString.Get("ID").ToString()
Dim MachineDataSet As DataSet = New DataSet()
MachineDataSet = MachineDB.SelectMachinebyId(Request.QueryString.Get("ID").ToString())
If MachineDataSet.Tables(0).Rows.Count > 0 Then
txtmachine = New TextBox
txtmachine = CType(dvwProduct.FindControl("txtMachineName"), TextBox)
txtmachine.Text = MachineDataSet.Tables(0).Rows(0)("MachineName").ToString()
txtmachine = New TextBox
txtmachine = CType(dvwProduct.FindControl("txtDescription"), TextBox)
txtmachine.Text = MachineDataSet.Tables(0).Rows(0)("MachineShortDescription").ToString()
txtmachine = New TextBox
txtmachine = CType(dvwProduct.FindControl("txtSpecification"), TextBox)
txtmachine.Text = MachineDataSet.Tables(0).Rows(0)("MachineSpecification").ToString()
Dim chkmachine As CheckBox = New CheckBox()
chkmachine = CType(dvwProduct.FindControl("checkIsAvailable"), CheckBox)
chkmachine.Checked = True
' chkmachine.Text = MachineDataSet.Tables(0).Rows(0)("MachineName").ToString()
txtmachine = New TextBox
txtmachine = CType(dvwProduct.FindControl("MachineCostCenterTextBox"), TextBox)
txtmachine.Text = MachineDataSet.Tables(0).Rows(0)("MachineCostCenter").ToString()
txtmachine = New TextBox
txtmachine = CType(dvwProduct.FindControl("ManPowerTextBox"), TextBox)
txtmachine.Text = MachineDataSet.Tables(0).Rows(0)("ManPower").ToString()
txtmachine = New TextBox
txtmachine = CType(dvwProduct.FindControl("CapecityTextBox"), TextBox)
txtmachine.Text = MachineDataSet.Tables(0).Rows(0)("Capecity").ToString()
txtmachine = New TextBox
txtmachine = CType(dvwProduct.FindControl("ProcessNameTextBox"), TextBox)
txtmachine.Text = MachineDataSet.Tables(0).Rows(0)("ProcessName").ToString()
'MachineName()
'MachineShortDescription()
'MachineSpecification()
'checkIsAvailable()
'MachineCostCenter()
'ManPower()
'Capecity()
'ProcessName()
End If
Else
System.Web.HttpContext.Current.Session("CompanyID") = SessionData.ActiveInstance.SessionFilters("CompanyID").ToString
System.Web.HttpContext.Current.Session("DivisionID") = SessionData.ActiveInstance.SessionFilters("DivisionID").ToString
System.Web.HttpContext.Current.Session("DepartmentID") = SessionData.ActiveInstance.SessionFilters("DepartmentID").ToString
txtmachine.Text = MachineDB.ReturnId()
End If
End If
End Sub
and aspx page
]]>
<asp:content id="Content1" contentplaceholderid="_header" runat="Server" xmlns:asp="#unknown">
<asp:content id="Content2" contentplaceholderid="_lockinfo" runat="Server" xmlns:asp="#unknown">
<asp:content id="Content3" contentplaceholderid="_mainContent" runat="Server" xmlns:asp="#unknown">
<asp:detailsview id="dvwProduct" runat="server" autogeneratedeletebutton="True" autogenerateeditbutton="True">
AutoGenerateInsertButton="True" AutoGenerateRows="False" DataKeyNames="ID" DataSourceID="objCurrProduct"
DefaultMode="Insert" HeaderText="Product Details" >
<fieldheaderstyle width="108px">
<fields>
<asp:templatefield headertext="Machine Id" sortexpression="DepartmentID">
<itemtemplate>
<asp:label id="lblMachineId" runat="server" text="<%# Eval(" machineid")="" %>"="">
<edititemtemplate>
<asp:textbox id="txtMachineId" runat="server" text="<%# Bind(" machineid")="" %>"="" width="300px">
<asp:templatefield headertext="Machine Name" sortexpression="DepartmentID">
<itemtemplate>
<asp:label id="lblMachineName" runat="server" text="<%# Eval(" machinename")="" %>"="">
<edititemtemplate>
<asp:textbox id="txtMachineName" runat="server" text="<%# Bind(" machinename")="" %>"="" width="300px">
<asp:templatefield headertext="Description" sortexpression="Title">
<itemtemplate>
<asp:label id="lblDescription" runat="server" text="<%# Eval(" machineshortdescription")="" %>"="">
<edititemtemplate>
<asp:textbox id="txtDescription" runat="server" text="<%# Bind(" machineshortdescription")="" %>"="" width="300px">
<asp:templatefield headertext="Specification" sortexpression="Description">
<itemtemplate>
<asp:label id="lblSpecification" runat="server" text="<%# Eval(" machinespecification")="" %>"="">
<edititemtemplate>
<asp:textbox id="txtSpecification" runat="server" text="<%# Bind(" machinespecification")="" %>"="" textmode="MultiLine" height="30" width="300px">
<asp:templatefield headertext="Is Available" sortexpression="SKU">
<itemtemplate>
<asp:checkbox id="checkIsAvailable" runat="server" width="300px">
<asp:templatefield headertext="Machine Cost Center" sortexpression="MachineCostCenter">
<itemtemplate>
<asp:label id="lblMachineCostCenter" runat="server" text="<%(" machinecostcenter")="" %>"="">
<edititemtemplate>
<asp:textbox id="MachineCostCenterTextBox" runat="server" text="<%# Bind(" machinecostcenter")="" %>"="" width="300px">
<asp:templatefield headertext="ManPower Used By Machine" sortexpression="ManPower">
<itemtemplate>
<asp:label id="lblManPower" runat="server" text="<%(" manpower")="" %>"="">
<edititemtemplate>
<asp:textbox id="ManPowerTextBox" runat="server" text="<%# Bind(" manpower")="" %>"="" width="300px">
<asp:templatefield headertext="Capecity Of Machine" sortexpression="Capecity">
<itemtemplate>
<asp:label id="lblCapecity" runat="server" text="<%(" capecity")="" %>"="">
<edititemtemplate>
<asp:textbox id="CapecityTextBox" runat="server" text="<%# Bind(" capecity")="" %>"="" width="300px">
<asp:templatefield headertext="Process For Machine " sortexpression="ProcessName">
<itemtemplate>
<asp:label id="lblProcessName" runat="server" text="<%(" processname")="" %>"="">
<edititemtemplate>
<asp:textbox id="ProcessNameTextBox" runat="server" text="<%# Bind(" processname")="" %>"="" width="300px">
<asp:objectdatasource id="objCurrProduct" runat="server" insertmethod="InsertProduct">
SelectMethod="SelectMachinebyId" TypeName="MachineDB" >
<selectparameters>
<asp:querystringparameter name="MachineId" querystringfield="ID">
<insertparameters>
<asp:parameter name="MachineID" type="String">
<asp:parameter name="MachineName" type="String">
<asp:parameter name="MachineShortDescription" type="String" convertemptystringtonull="false">
<asp:parameter name="MachineSpecification" type="String" convertemptystringtonull="false">
<asp:parameter name="MachineCostCenter" type="String" convertemptystringtonull="false">
<asp:parameter name="ManPower" type="int32">
<asp:parameter name="Capecity" type="int32">
<asp:parameter name="ProcessName" type="String" convertemptystringtonull="false">
<asp:sessionparameter name="CompanyID" sessionfield="CompanyID">
<asp:sessionparameter name="DivisionID" sessionfield="DivisionID">
<asp:sessionparameter name="DepartmentID" sessionfield="DepartmentID">
Raghvendra
|
|
|
|
|
Yeah.You are really in a big problem.
Debug the code and check where you are going wrong.
please don't forget to vote on the post that helped you.
|
|
|
|
|
I want to use listbox as Select ListBox.
I mean select one item from left side and add it to the other side.
I've used updatepanel for this purpose.
I have a minor problem:
in the code behind, it shows that it's doing its job correctly but the UI result is different.
and it happens irregularly.
I mean sometimes it works correctly.
Regards,
Bardia
|
|
|
|
|
|
This is the problem due to update panel.
Bardia Shahini wrote: I mean select one item from left side and add it to the other side.
How did you add items from one to another ? using any Button or ??
Bardia Shahini wrote: I've used updatepanel for this purpose.
How many update panel did you used ? if both list box are in different update panel then you should update both update panel after event fire.
if you are using button to navigate items, update both update panel on button Click, For that you have to set updatemode="Conditional" and on button click myupdatepanel.update()
hope this will helps you . if you have any dobts , then put your both Aspx and codebehind section.
cheers,
Abhijit
|
|
|
|
|
Thanks for reply,
I've used 4 buttons for transferring items from one side to the other side
MoveAll
MoveSelected
RetrunAll
ReturnSelected
and I've used a single Updatepanel.
this is my aspx code:
<updatepanel id="UpdatePanel1" runat="server" rendermode="Inline" updatemode="Conditional">
<contenttemplate>
<asp:listbox id="lstSource" runat="server" xmlns:asp="#unknown">
| <asp:button id="btnMoveAll" runat="server" text=">>" onclick="btnMoveAll_Click" xmlns:asp="#unknown">
<asp:button id="btnMoveSeleted" runat="server" text=">" onclick="btnMoveSeleted_Click" xmlns:asp="#unknown">
<asp:button id="btnRemoveSelected" runat="server" text="<" onclick="btnRemoveSelected_Click" xmlns:asp="#unknown">
<asp:button id="btnRemoveAll" runat="server" text="<<" onclick="btnRemoveAll_Click" xmlns:asp="#unknown">
| <asp:listbox id="lstDestination" runat="server" xmlns:asp="#unknown">
|
<triggers> <asp:asyncpostbacktrigger controlid="btnMoveSeleted" eventname="Click" xmlns:asp="#unknown">
<asp:asyncpostbacktrigger controlid="btnMoveAll" eventname="Click" xmlns:asp="#unknown">
<asp:asyncpostbacktrigger controlid="btnRemoveAll" eventname="Click" xmlns:asp="#unknown">
<asp:asyncpostbacktrigger controlid="btnRemoveSelected" eventname="Click" xmlns:asp="#unknown">
and this is my CodeBehind Code:
protected void btnMoveAll_Click(object sender, EventArgs e)
{
if (lstSource.Items.Count > 0)
{
int count = lstSource.Items.Count;
for (int i=0; i < count; i++)
{
lstDestination.Items.Add(lstSource.Items[i]);
}
lstSource.Items.Clear();
}
UpdatePanel1.Update();
}
protected void btnMoveSeleted_Click(object sender, EventArgs e)
{
if (lstSource.Items.Count > 0 && lstSource.SelectedValue != string.Empty)
{
lstDestination.Items.Add(lstSource.SelectedItem);
lstSource.Items.Remove(lstSource.SelectedItem);
}
UpdatePanel1.Update();
}
protected void btnRemoveSelected_Click(object sender, EventArgs e)
{
if (lstDestination.Items.Count > 0 && lstDestination.SelectedValue != string.Empty)
{
lstSource.Items.Add(lstDestination.SelectedItem);
lstDestination.Items.Remove(lstDestination.SelectedItem);
//SetListBoxIndexes();
}
UpdatePanel1.Update();
}
protected void btnRemoveAll_Click(object sender, EventArgs e)
{
if (lstDestination.Items.Count > 0)
{
int count = lstDestination.Items.Count;
for (int i=0; i < count; i++)
{
lstSource.Items.Add(lstDestination.Items[i]);
}
lstDestination.Items.Clear();
}
UpdatePanel1.Update();
}
regards,
Bardia
|
|
|
|
|
Hi guys
I am working with ajax toolkit and updating a panel that is working fine in my local system, all validations are working properly but when i am uploading this page on web server validation are firing but validation message is not displaying.
What is exact error i am not getting can any one help me
"http://www.usadigitizing.us/edit_registration.aspx["
krishna veer singh
|
|
|
|
|
krishnaveer wrote: all validations are working properly
which validation control are you using ?
cheers,
Abhijit
|
|
|
|
|
Required field Validatior
Regular Expression Validatior
Compare Validatior
krishna veer singh
|
|
|
|
|
Set Display="Static" for validation control
cheers,
Abhijit
|
|
|
|
|
Display="Static"
Validation are working Properly
and focus is also set on error text box, but error message is not displaying
krishna veer singh
|
|
|
|
|
Can you post the code for the validation control?
|
|
|
|
|
<asp:textbox id="txtPemail" runat="server" cssclass="input" maxlength="100" xmlns:asp="#unknown">
<asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server" controltovalidate="txtPemail" xmlns:asp="#unknown">
ErrorMessage="*" ValidationGroup="g2" SetFocusOnError="True">
<asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" controltovalidate="txtPemail" xmlns:asp="#unknown">
ErrorMessage="Invalid email-id" Font-Italic="False" Font-Size="Smaller" SetFocusOnError="True"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="g2"
Width="70px">
krishna veer singh
|
|
|
|
|
|
Hi Gaurav,
This is called CAPTCHA stands for "completely automated public Turing test to tell computers and humans apart."
many sites use it at the time of Sign in.
if you want to implement it
Basic Image Generation For Verification[^]
For Advance
CAPTCHA Image[^]
Hope this will help you.
Good luck!!!
cheers,
Abhijit
|
|
|
|
|
hi. iam create this controls and add my webform. its work.
but when Page IsPostBack then its run again.. read resource file...
i want just one time read resource file...
can you help me?
'control class
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Class MyButton
Inherits WebControls.Button
Private _translateLanguage As Boolean = True
Public Property TranstaleLanguage() As Boolean
Get
Return _translateLanguage
End Get
Set(ByVal value As Boolean)
_translateLanguage = value
End Set
End Property
Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs)
If TranstaleLanguage = True Then
Me.Text = Language.ResourceFile.GetString(Me.ID & "_Text")
End If
End Sub
End Class
modified on Monday, August 11, 2008 2:07 AM
|
|
|
|
|
if (Page.IsPostBack == false)
{
//your code
}
else
{
dont do anything
}
|
|
|
|
|
hi, i am create new button control and add my web form.
this control is run page preinit.
|
|
|
|
|
Hi, Im making a website with ASP.NET and C#. And in web.config I have disabled both viewstate and viewstatemac. But I still get the viewstatemac error when on a slooooow connection.
Thanks!
|
|
|
|
|
It would be important to highlight certain keywords in a message board for example or while searching for a keyword in ASP Search Engine, We are then in need of a function that would highlight certain keywords within the text of the messages.
|
|
|
|
|
You can try this way.
string myText="Hi,I am from Ahmedabad";
string searchText="Hi";
string result=myText.Replace(searchText,"<font style="color:red;font-weight:bold;">"+searchText+"</font>");
please don't forget to vote on the post that helped you.
|
|
|
|
|
Are you using any tool/engine for searching text in the message ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
Hi, I can't get the original HTML source in
((HTMLDocument)webBrowser1.Document).documentElement.innerHTML
as the HTML code in viewsource. The code comes without quotes and all of the tag names comes as upper case. Is there any way to get original source in axWebBrowser as in System.Windows.Froms.WebBrowser.DocumentText ?
baris
|
|
|
|
|
Hi,
i have this requirement. i have 50 records in my database. i want to show one record on page load. whenever i hit a button submit, it needs to show another record.
my doubt is how can i get the record value whenever button press, because, when i pressed submit button, the same code executes and again it gets the 1st record itself. but i want the next record by hitting the button. how can i persist the record no?
Another criteria:
if i press button, it navigates to another page and show some data and again get back to previous page by hiting some button on second page.
then how can i show the next record in first page?
G. Satish
|
|
|
|
|
Hi,
First get all 50 records at the page load and bind it to a GridView control at IsPostBack false condition, assigining PageSize property to 1 and AllowPaging property to true. And also set your primary key as the DataKeys in the GridView control.
For the PageIndexChanging event, store the selected page in a Sesssion variable and navigate to any page you want. And when returning back, before binding the GridView again assign the Session's PageIndex value to the GridView's PageIndex property. So that you will get the next page you want..By this way traversing to any page plus navigating to Previous Next options also will be posible.
Hope this helps.
Thx,
Gayani
|
|
|
|