|
i want to pass id from asp page so i can pass by using static id
but i want to pass id dynamically like using request querystring and i m fall to pass it, can any one solve how to pass id from html tags in asp.net
|
|
|
|
|
|
please I need help....after developing a web application using c# and with forms authentication for managing login, roles etc. its working fine but I notice when ever I log out and retun to my login page online and I don't close the browser window. then i hibernate my system....on returning to login an error pops up takin me to my error page..this does not happen if I close the browser window and access the app with a new window...
|
|
|
|
|
Deal with the error so you can handle it gracefully.
|
|
|
|
|
What error are you getting?
|
|
|
|
|
What is the error you get there.
or it's browser's functionality which cache the data for a while may be.
delete the browsing history.
or if possibility there could be a trouble with the session management.
try these options for checking .
|
|
|
|
|
Mr. Relevant,
I would like the support of relevant experts about the problem you are precious and I could not reach a conclusion on the long-term efforts.
The problem is that the checkbox to add a page I created on my autopostback asp.net I determine the true characteristic of a div block that displays true or false depending on whether or no to being normal.
The TextBox control is hooked into another RequiredFieldValidator control to prevent left blank.
I have seen pages that run had I autopostback work and did the research I've seen enableeventvalidatio the feature pages of this issue will be resolved by making false and I saw him try when autopostback try now but did not work RequiredFieldValidator control at this time. When I do enableeventvalidatio control true this time autopostback does not work, RequiredFieldValidator control started working.
The resources bulamadım.ilgil clear information when you search for the relevant foreign welcome.
I wish you good work.
|
|
|
|
|
is it possible for gridview to filter data based on input from a textbox like with listview in desktop app
|
|
|
|
|
Rather than getting the gridview to filter your data, you should filter the data yourself before you bind it to the gridview. Binding your data via code-behind rather than aspx markup gives you greater flexibility about how you bind data.
|
|
|
|
|
Hy all I had just shifted myself form Winform Development using ADO.net to ASP.net webform using Entity Framework 6..
After working with a little bit of Linq to entity for EF6 .I feel that there is no need of creating another layer for datalayer or business logic as we have aspx page for UI,.cs page for logic autogenerated Dbcontext for Datalayer
Am I correct or is it due to my inexperience ?
|
|
|
|
|
You can consider EF to be your "data tier" so there is no real need to create your own. You'll see lots of projects that look like this
namespace MyDA
{
public Person GetPerson(int id)
{
return ctx.Persons.Find(id);
}
public Person AddPerson(Person person)
{
return ctx.Persons.Add(person);
}
}
if your entire data tier is a list of single-line functions that simply "pass through" to EF then your tier is fairly redundant. The exception to this would be if you didn't want to tie your business tier to EF, and in that case you would probably give access to EF via a repository pattern rather than direct.
|
|
|
|
|
so in that Asp.net with EF is by default three tier isn't it?
|
|
|
|
|
Not necessarily, you could call EF code in your code behind pages making it two tier.
|
|
|
|
|
I think we need the business access layer as well.
|
|
|
|
|
Hello,
I have made a little to in asp.net webforms that displays or add users to an external database.
Also i have a button that generate a report with the current users in the users table.
A popup is opened with the add user form. But the problem i have is when pressing the add user button. It can take several seconds or more to add the data.
Now i want to make this async so when clicked the popup close and a message must appear when the data is added to the db.
I'm a bit stuck to make this possible.
Are threads or Tasks(TPL) something to consider to do this?
|
|
|
|
|
Tasks etc aren't going to help you, what you need to do is make the request asynchronous on the client side using ajax.
|
|
|
|
|
Hi experts,
When I execute the following code,
<asp:CheckBoxList ID="ckRequestReview" runat="server" CssClass="cb" Style="border-width: 0;" RepeatDirection="horizontal" RepeatColumns="4" RepeatLayout="Table">
<asp:ListItem>Step One</asp:ListItem>
<asp:ListItem>Step Two</asp:ListItem>
<asp:ListItem>Step Three</asp:ListItem>
</asp:CheckBoxList>
Dim items As String = String.Empty
If items = "Step One" Then
mypreferredChange = txtTitleChange.Text
ElseIf items = "Step Two" Then
mypreferredChange = "txtPayGradeChange"
ElseIf items = "Step Three" Then
mypreferredChange = "txtClassSpecChange"
Else
cmd.Parameters.Add(New SqlParameter("@RequestedChange", mypreferredChange))
Dim result As Integer = cmd.ExecuteNonQuery()
End If
The checkbox values are stored in one database column name called ChValues.
If a user checks one item, that one item is stored in that fieldname.
If user checks all three, all three are stored in that one fieldname, separated by comma.
In our situation, as in the example above, we have three items on the checkboxlist.
We would like to store the value of each checkboxlist into a separate fieldname.
Is this possible?
The idea is that when we query the db to retrieve these values, we would like each to have its own checkmark.
Thanks a lot in advance
|
|
|
|
|
Yes.
You would create your table with individual columns for each checkbox. You could make each column a char(1) and store Y or N.
|
|
|
|
|
Thank you for the prompt response.
This is what I have in mind.
Let's say I have three columns called simply, Column1, Column2, Column3
And I want to store the following values for them.
Column1 one gets Step One as value
Column2 gets Step Two as value
Column3 gets Step Three value stored in it.
Now, when I query the db to select all three columns, I would like each column preceded by checkmark like:
[]Step One []Step Two []Step Three
Note, I am using [] to represent checkmark.
How do I do this?
|
|
|
|
|
Create three columns (Step1 , Step2 and Step3 ) using the bit type. (This corresponds to the Boolean type in .NET.)
Find the items in the CheckBoxList and add them as separate parameters:
Dim item As ListBoxItem = ckRequestReview.Items.FindByText("Step One")
cmd.Parameters.AddWithValue("@Step1", item IsNot Nothing AndAlso item.Selected)
item = ckRequestReview.Items.FindByText("Step Two")
cmd.Parameters.AddWithValue("@Step2", item IsNot Nothing AndAlso item.Selected)
item = ckRequestReview.Items.FindByText("Step Three")
cmd.Parameters.AddWithValue("@Step3", item IsNot Nothing AndAlso item.Selected)
When you query the data, just select the three columns. The value of each column will be True if the item was selected, and False otherwise.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Awesome!
Thanks so much for your continued support Richard.
|
|
|
|
|
Yes, you can put you CheckBoxList Value into DB.
|
|
|
|
|
i Want to display an multiple images using datalist
asp Code:
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3" RepeatDirection="Horizontal"
Width="100%" BorderColor="#336699" BorderStyle="Solid" BorderWidth="2px">
<ItemTemplate>
<asp:Label ID="lblsStatus" runat="server"></asp:Label>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("imgname1") %>' Font-Bold="True"
Font-Size="10pt" ForeColor="#336699" Width="100%" />
<br />
<asp:Image ID="imgsss" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
</asp:DataList>
c#:
protected void Page_Load(object sender, EventArgs e)
{
FetchImage();
}
private object GetData(string query)
{
DataTable dt = new DataTable();
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand(query))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
sda.SelectCommand = cmd;
sda.Fill(dt);
}
}
return dt;
}
}
protected void FetchImage()
{
string id = "1";
imgss.Visible = id != "0";
if (id != "0")
{
byte[] bytes = (byte[])GetData("SELECT imgdata1 FROM Tbl_images WHERE id =" + id);
string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
imgss.ImageUrl = "imgdata1:image/png;base64," + base64String;
}
}
|
|
|
|
|
You didn't told what the problem, but I can spot a syntax problem that fixing it may help you...
... = "imgdata1:image/png;base64,"...
It should be
... = "data:image/png;base64,"...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
error:
Unable to cast object of type 'System.Data.DataTable' to type 'System.Byte[]'.
|
|
|
|