Welcome :Guest
 Sign In Register
Win Surprise Gifts!!!
Congratulations!!!

Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani
 Post New Web Links

## More Related Resource Links

### how to bind Dropdownlist based on textbox values

hi

I have one drodownlist which show data based om textbox values...

Let us consider i have

Select Name from table1 where Type IN(@typ)

here @typ is textbox values

here for example textbox will have some thing like this L1,L2,L3..

How to filter Name based and shown in drodownlist based on this L1,L2,L3(on textbox)..

Help me in this

### Saving textbox data to MySql database in asp.net

Hi dear coders

though a very simple question to ask, but please tell me how to save and retrieve data in/from my textboxes to/from database (MYSQL) on submit button click.

i know its a very simple task but i cant make it done, so i request you to please send me some working example link or post any helpful code here in asp.net

i will be highly thankful for any kind help from you geniuses.

regards

alok

### accessing values from a database with datalist?

I have a datalist and I am filling it using a dataadapter, dataset. So in my .ascx page, I have

<asp:datalist runat="server" id="dlProducts" repeatcolumns="2" repeatdirection="horizontal">

<itemtemplate>

<table border="0">

<tr><td><%# Eval("Item_Name") %></td></tr>

<tr><td>I have to add a picture here</td><td><%# Eval("First_Name") %></td></tr>

</table>

</itemtemplate>

</asp:datalist>

In the area where I have put a statement like "I have to add a picture here", I have write a big case statement.  Like:

Case: 6 // show a picture from file1

case: 7 // show a picture from file2

Case 8: //show a picture from file3

So How do I do this here?  Because I dont know how to access the datalist values from code behind.

Here is my code behind:

SQLString = "SELECT First_Name, Picture, item_name, item_id from table1 where item_id = " + request.querystring["iid"];

dataadapter daItems = new dataadapter(SQLString, "connection_name");

dataset dsItems = new dataset();

daItems.fill(dsItems);

dlProd

### Retain DropDown,TextBox's previously selected values after redirected from another page.

Hi People, How are you all doing?

I have 2 pages one is SearchPage & It has DropDowns, textboxes to specify the search criteria. From the search result the user is redirected to another page when he clicks the hyperlink in the search result  where he fills in the information and again redirected to SearchPage. Now the SearchPage is posted back with no state i just want to retain the search criteria and display when user comes back. Please give me some suggestion how to get this done. I've used ViewState to save the values and check them in Page_Load but they are null.

Thanks

Abid

Update: I've come up with this code. But the problem is The values are being retained but the Button_Click event is not being handled properly. When i Check the code even after this "DropDownList1.SelectedValue = Session["Name"].ToString();" DownList1.SelectedValue is EMPTY"" samw with DropDownList2 . please Suggest something

    protected void Page_Load(object sender, EventArgs e)
{
if (IsControlsEmpty())
{
if (SessionExist())
{
DropDownList1.SelectedValue = Session["Name"].ToString()

### Help with updating database with values from Repeater control using c#

Hello, I'm new to ASP.NET 3.5 with C#. I really need some help.

I used a Repeater control to create a simple (editable) list where, when a user logs in, they can edit their list of expenses.  The ASP page works fine.

My issue is with the code-behind.  I am really confused with how to extract the values from the repeater control. The FindControl method does not seem to be working.  Also, the code I am using resets my 'Amount' values back to 0.00. (0.00 is the amount the user sees when they first encounter the page).

Here's a portion of the code on the ASP page:

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"

onitemcommand="Repeater1_ItemCommand">

.

<ItemTemplate>

.

<td><asp:Label ID="lblExpId" runat="server"  Text='<%# Bind("ExpId") %>'></asp:Label> </td>

<td><asp:Textbox ID="lblExpense" runat="server" Width= "190px" Text='<%# Bind("ExpenseName") %>'></asp:Textbox> </td>

<td><asp:Textbox ID="txtAmount" runat="server" Width= "100px"

### Changing a textbox's readonly property right before update on a gridview

I have a gridview with a date field. I don't want the user to be able to type in their own date and mess up the format so I made the property readonly. That date is then set by a point and click interface. This is all working fine but when the user clicks update this field doesn't update because it's readonly. If i turn readonly off it works so is there a way to turn off the readonly property right before submit?

### How to stored values 10.57 into database

Hi,

I have the variable value 10.57
10.57 If I write, it stores data: 1057.00

I need 10.57 into database

thanks.

### gridview help on each dynamic row solve this show values based on all columns

<asp:GridView style="Z-INDEX: 101; LEFT: 1px; POSITION: absolute; TOP: 183px" id="Gridview1" runat="server" Width="613px" Height="127px" ForeColor="Teal" Font-Size="12pt" Font-Names="Palatino Linotype" Font-Bold="True" Visible="False" BorderColor="Transparent" AutoGenerateColumns="false" CellSpacing="2" GridLines="None" OnRowCreated="Gridview1_RowCreated" SelectedIndex="5" ShowFooter="true" OnRowDataBound="Gridview1_RowDataBound"><Columns>  <asp:TemplateField HeaderText="ItemCode"><ItemTemplate> <asp:DropDownList id="DropDownList1" tabIndex=16 runat="server" AutoPostBack="True" DataValueField=" ItemCode " DataTextField=" ItemCode" ></asp:DropDownList></ItemTemplate></asp:TemplateField>  <asp:TemplateField HeaderText="ItemName"><ItemTemplate> <asp:DropDownList id="DropDownList2" tabIndex=16 runat="server" AutoPostBack="True" DataValueField="ItemName" DataTextField="ItemName" ></asp:DropDownList> </ItemTemplate> </asp:TemplateField>  <asp:TemplateField HeaderText="Category"&

### Database is looking as (Suspect/readonly/offline/emergency/)

Could not open FCB for invalid file ID 0 in database 'mssc_admin' and database is looking as (Suspect/readonly/offline/emergency/) Actually log file is not visibiling and I was trying to restore it.   PLease PLease help"SQLSERVER DBA" "INDIA"

### Writing values back to a database

Hi All, I'm trying to write values back to an access database from an open source mathematical programming language (called glpk) using ODBC. I succeeded in doing so in most variables except one. The problem is described below: The following code gets an error when writing the data: \begin code:   table x3_iii {j in TF, k in C, p in P, t in T: x3[j,k,p,t]>0} OUT 'ODBC'   'FileDSN=.\d2.dsn'   'UPDATE ((Channels a INNER JOIN ChannelPeriodProducts b' 'ON a.ChannelID = b.ChannelID)' 'INNER JOIN TransformerTypes d' 'on a.OriginFacilityID = d.FacilityID' 'SET b.Quantity = ?'   'WHERE d.TransformerTypeID = ?'   'AND a.OriginFacilityID =?'   '    AND b.ProductID = ?'   '    AND b.PeriodID = ?':   x3[j, k, p, t], j, k, p, t; \end code Note that the sql is on multiple lines, because of a maximum strings limit in the glpk (but the way I used in the code is fine and worked without problems for writing other variables). Now, let me describe what I am basically trying to do: I'm trying to write the values for the variable x3[j,k,p,t] in its field "Quantity" in the table 'ChannelPeriodProducts'. The indices for that variable are j,k,p,t. The 'ChannelPeriodProducts' table has a "ChannelID", "PeriodID", "ProductID" and "Quantity" field

### How to show random information with C# from a SQL Database?

I have to do the following in my web page.  Any advice and how to do this please with C# I have a table where I have a column for different states (NY, NJ, etc).  People can join the group (in my page) for each state (the state where they live).  So I have to display the newest members for each state. So the way it should work is, every time the page is refreshed/reloaded it should show the state name as a header text and the first 5 newest members for that state.  This should be random, for example initially when the page is loaded say it will show state: New York and the 5 recent members like Stacy, Laura, Mike, Sam, Mathew. Then when the page is refreshed it will show another state like State: california and the recent 5 members All the information comes from the database How should I do this?

### SSRS Report based on SSAS Cubes doesn't show NULL values correctly

I have a SSRS report which is based on an SSAS Cube. In the Cube the formating of numeric fields that NULL values are properly shown as NULL values. In the Cube Browser and Excel this is shown correctly. However when I design the report already the query against SSAS shows these fields as "0" instead of NULL. Is there a way to fix this or is this a bug ?

### keep values in textbox in gridview whilst paging

Hi,   I have a gridview in my webpage which has paging enabled. There are around 5 textboxes in a row and when I enter some text and then move to another page and move back to the page I entered the values in, they are not lost. I have enabled the viewstate in the gridview. I have implemented a datatable to my grid which should hold the values in the viewstate. This worked before I added paging. Please can someone offer some advice as to how I can maintain the values in textboxes whilst moving between different pages? I have tried searching it but I can't seem to find any relevant info.   Thank you very much.

### Custom Validator on DDL&Textbox values

I need to write a 2 custom validators that works as follows: I have a formview (Formview1) with an EditItemTemplate. The validators need to validate values in "DropDownList1" and a textbox called "EndUserGUIDTextBox" If the value in DDL1 is ("Assigned" or "Assigned to End User") and the value of EndUserGUIDTextBox is ("unassigned" or "pending" or NULL) then I need a validator to fire and return {"GUID must be assigned when status is" & DLL1 value}. If the value in DDL1 is ("In Stock" or "In Repair") and EndUserGUIDTextBox is NOT ("unassigned" or "pending" or NULL), then I need a validator to fire and return {"GUID must not be assigned when status is" & DLL1 Value}. The validators needs to run and show in the formview when the UpdateButton in my Formview is clicked. I'm doing this in VB. Real noobie here! All help appreciated. Thanks,

### Validating Textbox for Numeric Values

I want to validate a textbox that only a numeric currency value can be put into it, for example 0.00. I thought the following code was correct but it doesnt seem to wrk, its causing an error on my page and when I remove it the page is fine, it doesn't actually give exact details of the error on the page just says "syntax error" in the browser that is all.<asp:CustomValidator runat="server" ErrorMessage="Please enter a numeric value for Night Rate in the format of 0.00" ID="NightRateNum" ControlToValidate="txtNightRate" Text="*" ClientValidationFunction="^\d+(\.\d\d)?\$"></asp:CustomValidator>Would appreciate if any can tell me where I went wrong Thanks

### show value in label on textbox change event

I want to show value in label on textbox change event , means when user enter text in text box then this value should display in label  . I am using this:<asp:UpdatePanel ID="UpdatePanel1" runat="server">    <ContentTemplate>     <asp:TextBox ID="TextBox5" runat="server" ontextchanged="TextBox5_TextChanged" AutoPostBack="true"></asp:TextBox>    </ContentTemplate>    </asp:UpdatePanel>========================================================protected void TextBox5_TextChanged(object sender, EventArgs e)     {         ViewState["xyz"] = Convert.ToInt32(TextBox4.Text) - Convert.ToInt32(TextBox5.Text);         ViewState["xyz1"] = Convert.ToInt32(ViewState["xyz"].ToString()) * 100;         lbldiff.Text = ViewState["xyz"].ToString();         lblprofit.Text = ViewState["xyz1"].ToString();     }protected void TextBox5_TextChanged(object sender, EventArgs e)    {        ViewState["xyz"] = Convert.ToInt32(TextBox4.Text) - Convert.ToInt32(TextBox5.Text);        ViewState["xyz1

### modelpopup will show only when textbox change

Hi..I have one asp.net Textbox and one Modelpopupextender...What my problem is on clicking on textbox it shows modelpopup but I need to show modelpopup only on textbox change or blur how to do?Help me in this
 Categories:
 ASP.Net Windows Application .NET Framework C# VB.Net ADO.Net Sql Server SharePoint Silverlight Others All