|
if condition something
{
response.redirect(page.aspx)
}
else
{
}
|
|
|
|
|
I got an application(xyz) and deployment(xyzDeploy) for the same[located in the same system]..When i was trying to run xyz and xyzDeploy at IIS .. xyz running fine and deployment application(xyzDeploy)
is throwing the error like:
Parser Error Message: The file '/xyzDeploy/Global.asax.cs' does not exist.
Source Error:
Line 1: <%@ Application CodeFile="Global.asax.cs" Inherits="CCS.Global" %>
Any ideas on what to try
|
|
|
|
|
Is global.asax.cs in your root folder?
|
|
|
|
|
Yes ... Global.asax.cs is located in the Root Folder only
if the position is wrong , the error should rise in both the cases..
Let me know where exactly it supposed to be
Thanks for ur reply
modified on Wednesday, July 9, 2008 7:04 AM
|
|
|
|
|
hi all
i have a gridview and button at the first load i bind to gridview one row consists of 2 template column for example, at the first column i put dropdownlist which load from database with text and value , secound column have a label when I select from dropdownlist the label load from the value
and the button in the same page when I click on it it create another row
but I meet 2 prolblem
1-the grid view dont carry the data in label and reload
2-the gridview.selectedindex=-1
Kareem Elhosseny
modified on Wednesday, July 9, 2008 5:33 AM
|
|
|
|
|
Hi
Does anyone know how to dynamically add a required field validator to a dynamically created control?
thanks
|
|
|
|
|
RequiredFieldValidator reqv = new RequiredFieldValidator();
reqv.ControlToValidate = "My_Cntrl_ID";
reqv.ErrorMessage="Err_Msg"
Control_Holder.Controls.Add(reqv);
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
thanks for the code suggestion
Ive added it but its showing the error message:
Unable to find control id 'tb' referenced by the 'ControlToValidate' property of ''.
all my code is as follows:
TextBox tb;
Label lb;
foreach (DataRow row in dataSetselectactivities.Tables[0].Rows)
{
lb = new Label();
tb = new TextBox();
lb.Text = "<br />" + row["field"].ToString() + " ";
tb.Text = row["field"].ToString();
RequiredFieldValidator reqv = new RequiredFieldValidator();
reqv.ControlToValidate = "tb";
reqv.ErrorMessage = "Err_Msg";
TextBoxesHere.Controls.Add(lb);
TextBoxesHere.Controls.Add(tb);
TextBoxesHere.Controls.Add(reqv);
}
|
|
|
|
|
.netman wrote: tb = new TextBox();
lb.Text = " " + row["field"].ToString() + " ";
tb.Text = row["field"].ToString();
RequiredFieldValidator reqv = new RequiredFieldValidator();
reqv.ControlToValidate = "tb";
tb = new TextBox();
tb.Id = "tb";
|
|
|
|
|
thanks for the reply navaneeth but I am now getting the following error message:
Multiple controls with the same ID 'tb' were found. FindControl requires that controls have unique IDs.
|
|
|
|
|
You are assigning the ids in a loop. So same id will repeat multiple times. You need to use random unique value as id.
foreach (DataRow row in dataSetselectactivities.Tables[0].Rows)
{
lb = new Label();
tb = new TextBox();
tb.Id = Guid.NewGuid().ToString();
lb.Text = "<br />" + row["field"].ToString() + " ";
tb.Text = row["field"].ToString();
RequiredFieldValidator reqv = new RequiredFieldValidator();
reqv.ControlToValidate = tb.Id;
reqv.ErrorMessage = "Err_Msg";
TextBoxesHere.Controls.Add(lb);
TextBoxesHere.Controls.Add(tb);
TextBoxesHere.Controls.Add(reqv);
} I used GUID as an example. You may use any unique value there.
|
|
|
|
|
Thanks for that.
The final thing is to loop all the textboxes I have just added and add the value from them into the database. Is it possible to loop controls like:
foreach (control in TextBoxesHere) something like that, or do I have to put them in an array?
cheers!
|
|
|
|
|
This should work
foreach (Control control in this.form1.Controls) {
if (control is TextBox) {
TextBox textBox = control as TextBox;
}
}
|
|
|
|
|
Im getting an input string error when I try to add the fields to the database.
I thnik it has something to do with the following parameter:
cmd_update.Parameters.Add(new SqlParameter("@field", SqlDbType.Int));
cmd_update.Parameters["@activity_order"].Value = tb.Text;
now tb.text is supposed to be the value from the dynamically created control in my page(the code to create the controls is in the third post on this thread) but its not working
any help on this would be great
thanks
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
CreateTextBoxes();
}
public void CreateTextBoxes()
{
int Count = 0;
foreach (DataRow row in dataSetselectactivities.Tables[0].Rows)
{
Count += 1;
lb = new Label();
tb = new TextBox();
tb.Id = "txt_" + Count;
lb.Text = row["field"].ToString();
tb.Text = row["field"].ToString();
RequiredFieldValidator reqv = new RequiredFieldValidator();
reqv.ControlToValidate = tb.Id;
reqv.ErrorMessage = "Err_Msg";
TextBoxesHere.Controls.Add(lb);
TextBoxesHere.Controls.Add(tb);
TextBoxesHere.Controls.Add(reqv);
}
}
string FifthTexBoxValue = ((TextBox)this.Page.FindControl("txt_5")).Text;
regards
Khan
please don't forget to vote on the post that helped you.
|
|
|
|
|
thanks for the reply.
but one thing, surely if i dont know how many textboxes there are then i cant do the following
Imran Khan Pathan wrote: string FifthTexBoxValue = ((TextBox)this.Page.FindControl("txt_5")).Text;
because I wont know if its called txt_5 or not, or am i misunderstanding what your saying?
|
|
|
|
|
.netman wrote: but one thing, surely if i dont know how many textboxes there are then i cant do the following
Yes.I just gave you an example.
Look at this code
int Count=1;
foreach (DataRow row in dataSetselectactivities.Tables[0].Rows)
{
string textboxValue= ((TextBox)this.Page.FindControl("txt_" + Count.ToString())).Text;
Count+=1;
}
by using above code, you can get all textbox value
regard
kHan
please don't forget to vote on the post that helped you.
|
|
|
|
|
Hai all,
i have facing a problem while navigating to paging in datalist.
i take 10 records for a page.it will display exact 10 records for the first time.
if i click second page then it will disply 13 records (3 records from the first page last) and
if i click 1 page fgrom 3rd page then also the records in the first page will be 13...
pls help me..through any suggestions
Thanks
Subbu.
|
|
|
|
|
Are you using custom paging or your own code for pageing, if its your own code please post
|
|
|
|
|
hi.. thanks for ur immediate reply..
pls check this
oncommand=NavigatePage
Protected Sub NavigatePage(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
Select Case e.CommandName
Case "PageNumber"
fintCurrentPage = Convert.ToInt32(e.CommandArgument)
Dim strselection As String = ""
strselection = SearchString
If SearchRange.Length > 0 And strselection.Length > 0 Then
strselection = strselection & " and " & SearchRange
ElseIf SearchRange.Length > 0 Then
strselection = SearchRange
End If
dsPros = getProList(strselection, SortString, fintCurrentPage, PAGE_SIZE)
Dim intNoOfRecs As Int32 = 0
Dim intTotPages As Int32 = 0
intNoOfRecs = CType(dsPros.Tables(1).Rows.Count, Int32)
intTotPages = CType(dsPros.Tables(0).Rows(0).Item(0), Int32)
FormatNavigationMenuBar(fintCurrentPage, intTotPages, PAGE_SIZE, RECS_IN_LIST)
dtlstPros.DataSource = dsPros.Tables(1)
dtlstPros.DataBind()
dtlstPros.UpdateAfterCallBack = True
'' lblListStatus.Text = "Displaying " & (((fintCurrentPage - 1) * PAGE_SIZE) + 1).ToString & " to " & ((fintCurrentPage - 1) * PAGE_SIZE) + intNoOfRecs.ToString & " of " & intTotPages.ToString & " matches"
lblListStatus.UpdateAfterCallBack = True
End Select
End Sub
Protected Function FormatNavigationMenuBar(ByVal CurrentPageNo As Integer, ByVal TotalNoOfRecords As Integer, _
ByVal MaxNoOfProductsOnAPage As Integer, ByVal ForwardNumber As Integer) As String
Dim intStartPageNo As Integer
Dim intPageCounter As Integer
Dim MaxNoOfBrowseToPageLinksOnAPage As Int32
MaxNoOfBrowseToPageLinksOnAPage = ForwardNumber
Dim intTotalPages As Integer
Dim objdtPageLink As New DataTable("PageLink ")
Dim drPageLink As DataRow
With objdtPageLink.Columns
.Add("PageNumber", System.Type.GetType("System.String"))
.Add("PageID", System.Type.GetType("System.String"))
End With
'Compute Total No. of Pages
intTotalPages = CInt(Math.Ceiling(TotalNoOfRecords / MaxNoOfProductsOnAPage))
'>> Finding Starting of series
If (CurrentPageNo Mod MaxNoOfBrowseToPageLinksOnAPage) = 0 Then
intStartPageNo = (CurrentPageNo + 1) - MaxNoOfBrowseToPageLinksOnAPage
Else
intStartPageNo = (CurrentPageNo - (CurrentPageNo Mod MaxNoOfBrowseToPageLinksOnAPage))
If intStartPageNo = 0 Then
intStartPageNo = 1
Else
intStartPageNo += 1
End If
End If
'<<
'>> Form Move Previous link
If Not CurrentPageNo = 1 Then
imgbtnTopMovePrev.ImageUrl = strZoominImgServer + "/images/Pro/Prev_Page.gif"
imgbtnTopMovePrev.CommandArgument = (CurrentPageNo - 1).ToString
imgbtnTopMovePrev.Visible = True
Else
imgbtnTopMovePrev.Visible = False
End If
'<<
'>> Form Move Previous n Pages link
If intStartPageNo > 1 Then
'imgbtnTopMoveFirst.ImageUrl = "~/images/Pro/Firstpage.gif"
lnkbtnTopMoveFirst.CommandArgument = (intStartPageNo - MaxNoOfBrowseToPageLinksOnAPage).ToString
lnkbtnTopMoveFirst.Visible = True
panTopMoveFirst.Visible = True
Else
lnkbtnTopMoveFirst.Visible = False
panTopMoveFirst.Visible = False
'drPageLink = objdtPageLink.NewRow
'drPageLink(0) = "<<"
'drPageLink(1) = (intStartPageNo - MaxNoOfBrowseToPageLinksOnAPage).ToString
'objdtPageLink.Rows.Add(drPageLink)
'objdtPageLink.AcceptChanges()
End If
'>> Form Page Links
For intPageCounter = intStartPageNo To (intStartPageNo + MaxNoOfBrowseToPageLinksOnAPage) - 1
If intPageCounter > intTotalPages Then Exit For
drPageLink = objdtPageLink.NewRow
drPageLink(0) = intPageCounter.ToString
drPageLink(1) = intPageCounter.ToString
objdtPageLink.Rows.Add(drPageLink)
objdtPageLink.AcceptChanges()
Next
'<<
'>> Form Move Next n Pages link
If (intStartPageNo + MaxNoOfBrowseToPageLinksOnAPage) <= intTotalPages Then
'imgbtnTopMoveLast.ImageUrl = "~/images/Pro/lastpage.gif"
lnkbtnTopMoveLast.CommandArgument = (intStartPageNo + MaxNoOfBrowseToPageLinksOnAPage).ToString
lnkbtnTopMoveLast.Visible = True
panTopMoveLast.Visible = True
Else
lnkbtnTopMoveLast.Visible = False
panTopMoveLast.Visible = False
'drPageLink = objdtPageLink.NewRow
'drPageLink(0) = ">>"
'drPageLink(1) = (intStartPageNo + MaxNoOfBrowseToPageLinksOnAPage).ToString
'objdtPageLink.Rows.Add(drPageLink)
'objdtPageLink.AcceptChanges()
End If
'<<
'>> Form Move Next link
'If Not (CurrentPageNo = intTotalPages) Then
If (CurrentPageNo < intTotalPages) Then
imgbtnTopMoveNext.ImageUrl = strZoominImgServer + "/images/Pro/Next_Page.gif"
imgbtnTopMoveNext.CommandArgument = (CurrentPageNo + 1).ToString
imgbtnTopMoveNext.Visible = True
Else
imgbtnTopMoveNext.Visible = False
End If
'<<
If objdtPageLink.Rows.Count = 0 Then
drPageLink = objdtPageLink.NewRow
drPageLink(0) = 1
drPageLink(1) = 1
objdtPageLink.Rows.Add(drPageLink)
objdtPageLink.AcceptChanges()
End If
dtlstTopNavigation.DataSource = objdtPageLink
dtlstTopNavigation.DataBind()
dtlstTopNavigation.UpdateAfterCallBack = True
imgbtnTopMoveNext.UpdateAfterCallBack = True
imgbtnTopMovePrev.UpdateAfterCallBack = True
lnkbtnTopMoveFirst.UpdateAfterCallBack = True
panTopMoveFirst.UpdateAfterCallBack = True
panTopMoveLast.UpdateAfterCallBack = True
lnkbtnTopMoveLast.UpdateAfterCallBack = True
TotalProsListed = TotalNoOfRecords
Return ""
End Function
#End Region
Thanks
Subbu.
|
|
|
|
|
is there any other possible way to bindgrid other than datasource = dataset;
datasource = datatable; datasource = arraylist; and any other
Bharani
|
|
|
|
|
What you are trying to do?
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
Yes ofcourse you can.
We can bind collections, such as Arraylists, Generic collections ie: anything that implements IEnumberable such as List<employee> and also DataTables, DataSets, can be directly assigned to the DataSource property of Data Controls such as GridViews, DataLists.
Thx,
Gayani
|
|
|
|
|
Hi
i have a form which has only employee number textbox and button when the user enter employee number it search the employee number from database and if the employee is found it must display employee details to another form which has all textboxes like names,surname,regionname.etc.I have search functionality which only works if i use one form so i must use two forms one for search and one for displaying
Mamphekgo
|
|
|
|
|
You just need to specify in your onclick event where you want the results to appear. You could use a panel for example and make it visible when you get the results.
This is not that hard to do.
|
|
|
|